]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- Change all BIT_{SET,CLR,TEST} to EBIT_ versions with enum types
authorwessels <>
Wed, 12 Nov 1997 07:08:44 +0000 (07:08 +0000)
committerwessels <>
Wed, 12 Nov 1997 07:08:44 +0000 (07:08 +0000)
- Change CWCB callback to use size_t size instead of int.
- Added LOG_TCP_DENIED

28 files changed:
src/access_log.cc
src/acl.cc
src/client_side.cc
src/comm.cc
src/defines.h
src/disk.cc
src/dns.cc
src/enums.h
src/errorpage.cc
src/fqdncache.cc
src/ftp.cc
src/gopher.cc
src/http.cc
src/icp_v2.cc
src/ident.cc
src/ipcache.cc
src/mime.cc
src/neighbors.cc
src/peer_select.cc
src/redirect.cc
src/refresh.cc
src/ssl.cc
src/stat.cc
src/store.cc
src/store_dir.cc
src/tunnel.cc
src/typedefs.h
src/wais.cc

index 0f6f4e70ca0153296ac9a22d64b6fd48089423a2..fbbf8c7d7609d4e70d876ce44bf109e2012f48af 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: access_log.cc,v 1.8 1997/11/05 05:29:16 wessels Exp $
+ * $Id: access_log.cc,v 1.9 1997/11/12 00:08:44 wessels Exp $
  *
  * DEBUG: section 46    Access Log
  * AUTHOR: Duane Wessels
@@ -46,6 +46,7 @@ const char *log_tags[] =
     "TCP_SWAPFAIL_MISS",
     "TCP_NEGATIVE_HIT",
     "TCP_MEM_HIT",
+    "TCP_DENIED",
     "UDP_HIT",
     "UDP_HIT_OBJ",
     "UDP_MISS",
index 829f1425478bc67be98a612956bdace6abecc9c0..6e9ddd5cd695ee9b2e44654a636469e7fc6fc567 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: acl.cc,v 1.113 1997/11/05 05:29:17 wessels Exp $
+ * $Id: acl.cc,v 1.114 1997/11/12 00:08:44 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -1229,7 +1229,7 @@ aclMatchAcl(struct _acl *acl, aclCheck_t * checklist)
        } else {
            /* register that we used the proxy authentication header */
            checklist->state[ACL_PROXY_AUTH] = ACL_LOOKUP_DONE;
-           BIT_SET(r->flags, REQ_USED_PROXY_AUTH);
+           EBIT_SET(r->flags, REQ_USED_PROXY_AUTH);
            return 1;
        }
        /* NOTREACHED */
index 38333778dfb99ab80010a0382b38f49da12f6fb4..b140bc75e14fab12dbb2f97d6e2be76a5e8b37e3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.143 1997/11/10 20:54:30 wessels Exp $
+ * $Id: client_side.cc,v 1.144 1997/11/12 00:08:45 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -121,6 +121,7 @@ clientAccessCheckDone(int answer, void *data)
        redirectStart(http, clientRedirectDone, http);
     } else {
        debug(33, 5) ("Access Denied: %s\n", http->url);
+       http->log_type = LOG_TCP_DENIED;
        redirectUrl = aclGetDenyInfoUrl(&Config.denyInfoList, AclMatchedName);
        if (redirectUrl) {
            err = errorCon(ERR_ACCESS_DENIED, HTTP_MOVED_TEMPORARILY);
@@ -183,7 +184,7 @@ icpProcessExpired(int fd, void *data)
 
     debug(33, 3) ("icpProcessExpired: FD %d '%s'\n", fd, http->url);
 
-    BIT_SET(http->request->flags, REQ_REFRESH);
+    EBIT_SET(http->request->flags, REQ_REFRESH);
     http->old_entry = http->entry;
     entry = storeCreateEntry(url,
        http->log_url,
@@ -222,7 +223,7 @@ clientGetsOldEntry(StoreEntry * new_entry, StoreEntry * old_entry, request_t * r
     }
     /* If the client did not send IMS in the request, then it
      * must get the old object, not this "Not Modified" reply */
-    if (!BIT_TEST(request->flags, REQ_IMS)) {
+    if (!EBIT_TEST(request->flags, REQ_IMS)) {
        debug(33, 5) ("clientGetsOldEntry: YES, no client IMS\n");
        return 1;
     }
@@ -388,6 +389,7 @@ clientPurgeRequest(clientHttpRequest * http)
     const cache_key *k;
     debug(33, 3) ("Config.onoff.enable_purge = %d\n", Config.onoff.enable_purge);
     if (!Config.onoff.enable_purge) {
+       http->log_type = LOG_TCP_DENIED;
        err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN);
        err->request = requestLink(http->request);
        err->src_addr = http->conn->peer.sin_addr;
@@ -411,7 +413,7 @@ clientPurgeRequest(clientHttpRequest * http)
 int
 checkNegativeHit(StoreEntry * e)
 {
-    if (!BIT_TEST(e->flag, ENTRY_NEGCACHED))
+    if (!EBIT_TEST(e->flag, ENTRY_NEGCACHED))
        return 0;
     if (e->expires <= squid_curtime)
        return 0;
@@ -530,7 +532,7 @@ icpParseRequestHeaders(clientHttpRequest * http)
     request->ims = -2;
     request->imslen = -1;
     if ((t = mime_get_header(request_hdr, "If-Modified-Since"))) {
-       BIT_SET(request->flags, REQ_IMS);
+       EBIT_SET(request->flags, REQ_IMS);
        request->ims = parse_rfc1123(t);
        while ((t = strchr(t, ';'))) {
            for (t++; isspace(*t); t++);
@@ -540,22 +542,22 @@ icpParseRequestHeaders(clientHttpRequest * http)
     }
     if ((t = mime_get_header(request_hdr, "Pragma"))) {
        if (!strcasecmp(t, "no-cache"))
-           BIT_SET(request->flags, REQ_NOCACHE);
+           EBIT_SET(request->flags, REQ_NOCACHE);
     }
     if (mime_get_header(request_hdr, "Range")) {
-       BIT_SET(request->flags, REQ_NOCACHE);
-       BIT_SET(request->flags, REQ_RANGE);
+       EBIT_SET(request->flags, REQ_NOCACHE);
+       EBIT_SET(request->flags, REQ_RANGE);
     } else if (mime_get_header(request_hdr, "Request-Range")) {
-       BIT_SET(request->flags, REQ_NOCACHE);
-       BIT_SET(request->flags, REQ_RANGE);
+       EBIT_SET(request->flags, REQ_NOCACHE);
+       EBIT_SET(request->flags, REQ_RANGE);
     }
     if (mime_get_header(request_hdr, "Authorization"))
-       BIT_SET(request->flags, REQ_AUTH);
+       EBIT_SET(request->flags, REQ_AUTH);
     if (request->login[0] != '\0')
-       BIT_SET(request->flags, REQ_AUTH);
+       EBIT_SET(request->flags, REQ_AUTH);
     if ((t = mime_get_header(request_hdr, "Proxy-Connection"))) {
        if (!strcasecmp(t, "Keep-Alive"))
-           BIT_SET(request->flags, REQ_PROXY_KEEPALIVE);
+           EBIT_SET(request->flags, REQ_PROXY_KEEPALIVE);
     }
     if ((t = mime_get_header(request_hdr, "Via")))
        if (strstr(t, ThisCache)) {
@@ -564,7 +566,7 @@ icpParseRequestHeaders(clientHttpRequest * http)
                    http->url);
                debug(12, 1) ("--> %s\n", t);
            }
-           BIT_SET(request->flags, REQ_LOOPDETECT);
+           EBIT_SET(request->flags, REQ_LOOPDETECT);
        }
 #if USE_USERAGENT_LOG
     if ((t = mime_get_header(request_hdr, "User-Agent")))
@@ -622,9 +624,9 @@ icpHierarchical(clientHttpRequest * http)
 
     /* IMS needs a private key, so we can use the hierarchy for IMS only
      * if our neighbors support private keys */
-    if (BIT_TEST(request->flags, REQ_IMS) && !neighbors_do_private_keys)
+    if (EBIT_TEST(request->flags, REQ_IMS) && !neighbors_do_private_keys)
        return 0;
-    if (BIT_TEST(request->flags, REQ_AUTH))
+    if (EBIT_TEST(request->flags, REQ_AUTH))
        return 0;
     if (method == METHOD_TRACE)
        return 1;
@@ -634,7 +636,7 @@ icpHierarchical(clientHttpRequest * http)
     for (p = Config.hierarchy_stoplist; p; p = p->next)
        if (strstr(url, p->key))
            return 0;
-    if (BIT_TEST(request->flags, REQ_LOOPDETECT))
+    if (EBIT_TEST(request->flags, REQ_LOOPDETECT))
        return 0;
     if (request->protocol == PROTO_HTTP)
        return httpCachable(method);
@@ -648,7 +650,7 @@ icpHierarchical(clientHttpRequest * http)
 }
 
 static void
-clientErrorComplete(int fd, void *data, int size)
+clientErrorComplete(int fd, void *data, size_t size)
 {
     clientHttpRequest *http = data;
     if (http)
@@ -735,7 +737,7 @@ clientBuildReplyHeader(clientHttpRequest * http,
     snprintf(ybuf, 4096, "X-Cache: %s", isTcpHit(http->log_type) ? "HIT" : "MISS");
     clientAppendReplyHeader(hdr_out, ybuf, &len, out_sz);
     /* Append Proxy-Connection: */
-    if (BIT_TEST(http->request->flags, REQ_PROXY_KEEPALIVE)) {
+    if (EBIT_TEST(http->request->flags, REQ_PROXY_KEEPALIVE)) {
        snprintf(ybuf, 4096, "Proxy-Connection: Keep-Alive");
        clientAppendReplyHeader(hdr_out, ybuf, &len, out_sz);
     }
@@ -869,7 +871,7 @@ clientSendMoreData(void *data, char *buf, ssize_t size)
 }
 
 void
-clientWriteComplete(int fd, char *bufnotused, int size, int errflag, void *data)
+clientWriteComplete(int fd, char *bufnotused, size_t size, int errflag, void *data)
 {
     clientHttpRequest *http = data;
     ConnStateData *conn;
@@ -897,7 +899,7 @@ clientWriteComplete(int fd, char *bufnotused, int size, int errflag, void *data)
            http->out.size);
        if (http->entry->mem_obj->reply->content_length <= 0) {
            comm_close(fd);
-       } else if (BIT_TEST(http->request->flags, REQ_PROXY_KEEPALIVE)) {
+       } else if (EBIT_TEST(http->request->flags, REQ_PROXY_KEEPALIVE)) {
            debug(12, 5) ("clientWriteComplete: FD %d Keeping Alive\n", fd);
            conn = http->conn;
            httpRequestFree(http);
@@ -1011,7 +1013,7 @@ icpGetHeadersForIMS(void *data, char *buf, ssize_t size)
 }
 
 static void
-icpHandleIMSComplete(int fd, char *bufnotused, int size, int errflag, void *data)
+icpHandleIMSComplete(int fd, char *bufnotused, size_t size, int flag, void *data)
 {
     clientHttpRequest *http = data;
     StoreEntry *entry = http->entry;
@@ -1025,7 +1027,7 @@ icpHandleIMSComplete(int fd, char *bufnotused, int size, int errflag, void *data
     http->entry = NULL;
     http->out.size += size;
     http->al.http.code = 304;
-    if (errflag != COMM_ERR_CLOSING)
+    if (flag != COMM_ERR_CLOSING)
        comm_close(fd);
 }
 
@@ -1069,15 +1071,15 @@ icpProcessRequest(int fd, clientHttpRequest * http)
        return;
     }
     if (icpCachable(http))
-       BIT_SET(request->flags, REQ_CACHABLE);
+       EBIT_SET(request->flags, REQ_CACHABLE);
     if (icpHierarchical(http))
-       BIT_SET(request->flags, REQ_HIERARCHICAL);
+       EBIT_SET(request->flags, REQ_HIERARCHICAL);
     debug(12, 5) ("icpProcessRequest: REQ_NOCACHE = %s\n",
-       BIT_TEST(request->flags, REQ_NOCACHE) ? "SET" : "NOT SET");
+       EBIT_TEST(request->flags, REQ_NOCACHE) ? "SET" : "NOT SET");
     debug(12, 5) ("icpProcessRequest: REQ_CACHABLE = %s\n",
-       BIT_TEST(request->flags, REQ_CACHABLE) ? "SET" : "NOT SET");
+       EBIT_TEST(request->flags, REQ_CACHABLE) ? "SET" : "NOT SET");
     debug(12, 5) ("icpProcessRequest: REQ_HIERARCHICAL = %s\n",
-       BIT_TEST(request->flags, REQ_HIERARCHICAL) ? "SET" : "NOT SET");
+       EBIT_TEST(request->flags, REQ_HIERARCHICAL) ? "SET" : "NOT SET");
 
     /* NOTE on HEAD requests: We currently don't cache HEAD reqeusts
      * at all, so look for the corresponding GET object, or just go
@@ -1092,7 +1094,7 @@ icpProcessRequest(int fd, clientHttpRequest * http)
     if ((entry = storeGet(pubkey)) == NULL) {
        /* this object isn't in the cache */
        http->log_type = LOG_TCP_MISS;
-    } else if (BIT_TEST(entry->flag, ENTRY_SPECIAL)) {
+    } else if (EBIT_TEST(entry->flag, ENTRY_SPECIAL)) {
        if (entry->mem_status == IN_MEMORY)
            http->log_type = LOG_TCP_MEM_HIT;
        else
@@ -1101,15 +1103,15 @@ icpProcessRequest(int fd, clientHttpRequest * http)
        http->log_type = LOG_TCP_MISS;
        storeRelease(entry);
        entry = NULL;
-    } else if (BIT_TEST(request->flags, REQ_NOCACHE)) {
+    } else if (EBIT_TEST(request->flags, REQ_NOCACHE)) {
        /* NOCACHE should always eject a negative cached object */
-       if (BIT_TEST(entry->flag, ENTRY_NEGCACHED))
+       if (EBIT_TEST(entry->flag, ENTRY_NEGCACHED))
            storeRelease(entry);
        /* NOCACHE+IMS should not eject a valid object */
-       else if (BIT_TEST(request->flags, REQ_IMS))
+       else if (EBIT_TEST(request->flags, REQ_IMS))
            (void) 0;
        /* Request-Range should not eject a valid object */
-       else if (BIT_TEST(request->flags, REQ_RANGE))
+       else if (EBIT_TEST(request->flags, REQ_RANGE))
            (void) 0;
        else
            storeRelease(entry);
@@ -1126,7 +1128,7 @@ icpProcessRequest(int fd, clientHttpRequest * http)
            http->log_type = LOG_TCP_REFRESH_MISS;
        else
            http->log_type = LOG_TCP_MISS;      /* XXX zoinks */
-    } else if (BIT_TEST(request->flags, REQ_IMS)) {
+    } else if (EBIT_TEST(request->flags, REQ_IMS)) {
        /* User-initiated IMS request for something we think is valid */
        http->log_type = LOG_TCP_IMS_MISS;
     } else {
@@ -1437,7 +1439,7 @@ clientReadRequest(int fd, void *data)
        }
        /* It might be half-closed, we can't tell */
        debug(12, 5) ("clientReadRequest: FD %d closed?\n", fd);
-       BIT_SET(F->flags, FD_SOCKET_EOF);
+       EBIT_SET(F->flags, FD_SOCKET_EOF);
        conn->defer.until = squid_curtime + 1;
        conn->defer.n++;
        commSetSelect(fd, COMM_SELECT_READ, clientReadRequest, conn, 0);
@@ -1651,9 +1653,9 @@ CheckQuickAbort2(const clientHttpRequest * http)
     long minlen;
     long expectlen;
 
-    if (!BIT_TEST(http->request->flags, REQ_CACHABLE))
+    if (!EBIT_TEST(http->request->flags, REQ_CACHABLE))
        return 1;
-    if (BIT_TEST(http->entry->flag, KEY_PRIVATE))
+    if (EBIT_TEST(http->entry->flag, KEY_PRIVATE))
        return 1;
     if (http->entry->mem_obj == NULL)
        return 1;
@@ -1711,7 +1713,6 @@ icpCheckTransferDone(clientHttpRequest * http)
        return 0;
     if (mem->reply->content_length == 0)
        return 0;
-    assert(http->out.offset <= mem->reply->content_length + mem->reply->hdr_sz);
     if (http->out.offset >= mem->reply->content_length + mem->reply->hdr_sz)
        return 1;
     return 0;
index 69a01586019500c8d6239e6e35b6a4017b22d759..2a52670576a19dde140212c6568e30561e10d6cf 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.201 1997/11/05 05:29:21 wessels Exp $
+ * $Id: comm.cc,v 1.202 1997/11/12 00:08:46 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -265,7 +265,7 @@ comm_open(int sock_type,
     debug(5, 5) ("comm_open: FD %d is a new socket\n", new_socket);
     fd_open(new_socket, FD_SOCKET, note);
     F = &fd_table[new_socket];
-    if (!BIT_TEST(flags, COMM_NOCLOEXEC))
+    if (!(flags & COMM_NOCLOEXEC))
        commSetCloseOnExec(new_socket);
     if (port > (u_short) 0) {
        commSetNoLinger(new_socket);
@@ -280,7 +280,7 @@ comm_open(int sock_type,
     }
     F->local_port = port;
 
-    if (BIT_TEST(flags, COMM_NONBLOCKING))
+    if (flags & COMM_NONBLOCKING)
        if (commSetNonBlocking(new_socket) == COMM_ERROR)
            return -1;
 #ifdef TCP_NODELAY
@@ -604,11 +604,11 @@ comm_close(int fd)
     assert(fd >= 0);
     assert(fd < Squid_MaxFD);
     F = &fd_table[fd];
-    if (BIT_TEST(F->flags, FD_CLOSING))
+    if (EBIT_TEST(F->flags, FD_CLOSING))
        return;
     assert(F->open);
     assert(F->type != FD_FILE);
-    BIT_SET(F->flags, FD_CLOSING);
+    EBIT_SET(F->flags, FD_CLOSING);
     CommWriteStateCallbackAndFree(fd, COMM_ERR_CLOSING);
     commCallCloseHandlers(fd);
     if (F->uses)               /* assume persistent connect count */
index a7d9339004d5a8e07051df0d17ceebffa094adf7..3432944f674ef35552024af68b9a8d0bf7ca9fa0 100644 (file)
 #define COMM_ERR_DNS     (-8)
 #define COMM_ERR_CLOSING (-9)
 
-#define COMM_NONBLOCKING  (0x1)
-#define COMM_NOCLOEXEC   (0x8)
-
 /* Select types. */
 #define COMM_SELECT_READ   (0x1)
 #define COMM_SELECT_WRITE  (0x2)
 #define MAX_DEBUG_SECTIONS 100
 
+#define COMM_NONBLOCKING       0x01
+#define COMM_NOCLOEXEC         0x02
+
 #ifdef HAVE_SYSLOG
 #define debug(SECTION, LEVEL) \
         ((_db_level = (LEVEL)) > debugLevels[SECTION]) ? (void) 0 : _db_print
 #define DISK_EOF                 (-2)
 #define DISK_NO_SPACE_LEFT       (-6)
 
-#define DNS_FLAG_ALIVE          0x01
-#define DNS_FLAG_BUSY           0x02
-#define DNS_FLAG_CLOSING        0x04
-
 #define DNS_INBUF_SZ 4096
 
-#define FD_CLOSE_REQUEST       0x02
-#define FD_WRITE_DAEMON                0x04
-#define FD_WRITE_PENDING       0x08
-#define FD_CLOSING             0x10
-#define FD_SOCKET_EOF          0x40
-
 #define FD_DESC_SZ             64
 
 #define FQDN_FLAG_UNUSED_01    0x01
 #define FQDN_LOOKUP_IF_MISS    0x02
-
 #define FQDN_MAX_NAMES 5
-
 #define FQDNCACHE_AV_FACTOR 1000
 
 /*  
 /* Mark a neighbor cache as dead if it doesn't answer this many pings */
 #define HIER_MAX_DEFICIT  20
 
-/* bitfields for peer->options */
-#define NEIGHBOR_PROXY_ONLY            0x01
-#define NEIGHBOR_NO_QUERY              0x02
-#define NEIGHBOR_DEFAULT_PARENT                0x04
-#define NEIGHBOR_ROUNDROBIN            0x08
-#define NEIGHBOR_MCAST_RESPONDER       0x10
-#define NEIGHBOR_CLOSEST_ONLY          0x20
-
 #define ICP_FLAG_HIT_OBJ     0x80000000ul
 #define ICP_FLAG_SRC_RTT     0x40000000ul
 
 #define SM_PAGE_SIZE 4096
 #define DISK_PAGE_SIZE  8192
 
+#if UNUSED_CODE
 #define BIT_SET(flag, bit)     ((flag) |= (bit))
 #define BIT_CLR(flag, bit)     ((flag) &= ~(bit))
 #define BIT_TEST(flag, bit)    ((flag) & (bit))
+#endif
 
 #define EBIT_SET(flag, bit)    ((flag) |= ((1<<bit)))
 #define EBIT_CLR(flag, bit)    ((flag) &= ~((1<<bit)))
 #define EBIT_TEST(flag, bit)   ((flag) & ((1<<bit)))
 
-#define ENTRY_VALIDATED                (1<<16)
-#define ENTRY_UNUSED15         (1<<15)
-#define ENTRY_NEGCACHED                (1<<14)
-#define HIERARCHICAL           (1<<13)         /* can we query neighbors? */
-#define KEY_PRIVATE            (1<<12)         /* is the key currently private? */
-#define ENTRY_DISPATCHED       (1<<11)
-#define ENTRY_UNUSED10                 (1<<10)
-#define ENTRY_UNUSED09                 (1<<9)
-#define ENTRY_UNUSED08         (1<<8)
-#define ENTRY_CACHABLE         (1<<7)
-#define REFRESH_REQUEST        (1<<6)
-#define RELEASE_REQUEST        (1<<5)
-#define ENTRY_UNUSED04         (1<<4)
-#define DELAY_SENDING          (1<<3)
-#define ENTRY_REVALIDATE       (1<<2)
-#define ENTRY_UNUSED01         (1<<1)
-#define ENTRY_SPECIAL          (1<<0)
-
 #define MAX_FILES_PER_DIR (1<<20)
 
 #define MAX_URL  4096
 #define MAX_LOGIN_SZ  128
 
-/* bitfields for request_t->flags */
-#define REQ_RANGE              0x01
-#define REQ_NOCACHE            0x02
-#define REQ_IMS                        0x04
-#define REQ_AUTH               0x08
-#define REQ_CACHABLE           0x10
-#define REQ_UNUSED2            0x20
-#define REQ_HIERARCHICAL       0x40
-#define REQ_LOOPDETECT         0x80
-#define REQ_PROXY_KEEPALIVE    0x100
-#define REQ_PROXYING           0x200
-#define REQ_REFRESH            0x400
-#define REQ_USED_PROXY_AUTH    0x800
 #define PEER_MAX_ADDRESSES 10
 #define RTT_AV_FACTOR      1000
 
 #define ERROR_BUF_SZ (MAX_URL << 2)
 #endif
 
-#define ERR_FLAG_CBDATA                0x01
-
-#define HTTP_PROXYING          (1<<0)
-#define HTTP_KEEPALIVE         (1<<1)
-
 #define READ_AHEAD_GAP         (1<<14)
index 5eada8d1a7856e1f8dec6610be0cf83d0a861e56..4e0e922f77ae4957524dcbc368686d419ef5bbb1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: disk.cc,v 1.91 1997/11/05 05:29:22 wessels Exp $
+ * $Id: disk.cc,v 1.92 1997/11/12 00:08:47 wessels Exp $
  *
  * DEBUG: section 6     Disk I/O Routines
  * AUTHOR: Harvest Derived
@@ -193,12 +193,12 @@ file_close(int fd)
     fde *F = &fd_table[fd];
     assert(fd >= 0);
     assert(F->open);
-    if (BIT_TEST(F->flags, FD_WRITE_DAEMON)) {
-       BIT_SET(F->flags, FD_CLOSE_REQUEST);
+    if (EBIT_TEST(F->flags, FD_WRITE_DAEMON)) {
+       EBIT_SET(F->flags, FD_CLOSE_REQUEST);
        return;
     }
-    if (BIT_TEST(F->flags, FD_WRITE_PENDING)) {
-       BIT_SET(F->flags, FD_CLOSE_REQUEST);
+    if (EBIT_TEST(F->flags, FD_WRITE_PENDING)) {
+       EBIT_SET(F->flags, FD_CLOSE_REQUEST);
        return;
     }
     fd_close(fd);
@@ -313,16 +313,16 @@ diskHandleWriteComplete(void *data, int len, int errcode)
     if (fdd->write_q == NULL) {
        /* no more data */
        fdd->write_q_tail = NULL;
-       BIT_CLR(F->flags, FD_WRITE_PENDING);
-       BIT_CLR(F->flags, FD_WRITE_DAEMON);
+       EBIT_CLR(F->flags, FD_WRITE_PENDING);
+       EBIT_CLR(F->flags, FD_WRITE_DAEMON);
     } else {
        /* another block is queued */
        commSetSelect(fd, COMM_SELECT_WRITE, diskHandleWrite, NULL, 0);
-       BIT_SET(F->flags, FD_WRITE_DAEMON);
+       EBIT_SET(F->flags, FD_WRITE_DAEMON);
     }
     if (fdd->wrt_handle)
        fdd->wrt_handle(fd, status, len, fdd->wrt_handle_data);
-    if (BIT_TEST(F->flags, FD_CLOSE_REQUEST))
+    if (EBIT_TEST(F->flags, FD_CLOSE_REQUEST))
        file_close(fd);
 }
 
@@ -352,7 +352,7 @@ file_write(int fd,
     F->disk.wrt_handle = handle;
     F->disk.wrt_handle_data = handle_data;
     /* add to queue */
-    BIT_SET(F->flags, FD_WRITE_PENDING);
+    EBIT_SET(F->flags, FD_WRITE_PENDING);
     if (F->disk.write_q == NULL) {
        /* empty queue */
        F->disk.write_q = F->disk.write_q_tail = wq;
@@ -360,13 +360,13 @@ file_write(int fd,
        F->disk.write_q_tail->next = wq;
        F->disk.write_q_tail = wq;
     }
-    if (!BIT_TEST(F->flags, FD_WRITE_DAEMON)) {
+    if (!EBIT_TEST(F->flags, FD_WRITE_DAEMON)) {
 #if USE_ASYNC_IO
        diskHandleWrite(fd, NULL);
 #else
        commSetSelect(fd, COMM_SELECT_WRITE, diskHandleWrite, NULL, 0);
 #endif
-       BIT_SET(F->flags, FD_WRITE_DAEMON);
+       EBIT_SET(F->flags, FD_WRITE_DAEMON);
     }
     return DISK_OK;
 }
index d283bff7613617408b62d230e684ce185af53b1c..acd8ec02d76458964c91b4578ed413fd9757dfd1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dns.cc,v 1.44 1997/10/27 22:49:26 wessels Exp $
+ * $Id: dns.cc,v 1.45 1997/11/12 00:08:48 wessels Exp $
  *
  * DEBUG: section 34    Dnsserver interface
  * AUTHOR: Harvest Derived
@@ -214,11 +214,11 @@ dnsGetFirstAvailable(void)
     dnsserver_t *dns = NULL;
     for (k = 0; k < NDnsServersAlloc; k++) {
        dns = *(dns_child_table + k);
-       if (BIT_TEST(dns->flags, DNS_FLAG_BUSY))
+       if (EBIT_TEST(dns->flags, HELPER_BUSY))
            continue;
-       if (BIT_TEST(dns->flags, DNS_FLAG_CLOSING))
+       if (EBIT_TEST(dns->flags, HELPER_CLOSING))
            continue;
-       if (!BIT_TEST(dns->flags, DNS_FLAG_ALIVE))
+       if (!EBIT_TEST(dns->flags, HELPER_ALIVE))
            continue;
        return dns;
     }
@@ -257,14 +257,14 @@ dnsOpenServers(void)
        dns_child_table[k] = xcalloc(1, sizeof(dnsserver_t));
        if ((dnssocket = dnsOpenServer(prg)) < 0) {
            debug(34, 1) ("dnsOpenServers: WARNING: Failed to start 'dnsserver' #%d.\n", k + 1);
-           dns_child_table[k]->flags &= ~DNS_FLAG_ALIVE;
+           EBIT_CLR(dns_child_table[k]->flags, HELPER_ALIVE);
            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",
                dnssocket, prg, k + 1);
-           dns_child_table[k]->flags |= DNS_FLAG_ALIVE;
+           EBIT_SET(dns_child_table[k]->flags, HELPER_ALIVE);
            dns_child_table[k]->id = k + 1;
            dns_child_table[k]->inpipe = dnssocket;
            dns_child_table[k]->outpipe = dnssocket;
@@ -315,9 +315,9 @@ dnsStats(StoreEntry * sentry)
        dns = *(dns_child_table + k);
        storeAppendPrintf(sentry, "{dnsserver #%d:}\n", k + 1);
        storeAppendPrintf(sentry, "{    Flags: %c%c%c}\n",
-           dns->flags & DNS_FLAG_ALIVE ? 'A' : ' ',
-           dns->flags & DNS_FLAG_BUSY ? 'B' : ' ',
-           dns->flags & DNS_FLAG_CLOSING ? 'C' : ' ');
+           EBIT_TEST(dns->flags, HELPER_ALIVE) ? 'A' : ' ',
+           EBIT_TEST(dns->flags, HELPER_BUSY) ? 'B' : ' ',
+           EBIT_TEST(dns->flags, HELPER_CLOSING) ? 'C' : ' ');
        storeAppendPrintf(sentry, "{    FDs (in/out): %d/%d}\n",
            dns->inpipe, dns->outpipe);
        storeAppendPrintf(sentry, "{    Alive since: %s}\n",
@@ -351,15 +351,15 @@ dnsShutdownServers(void)
        return;
     for (k = 0; k < NDnsServersAlloc; k++) {
        dnsData = *(dns_child_table + k);
-       if (!(dnsData->flags & DNS_FLAG_ALIVE)) {
+       if (!EBIT_TEST(dnsData->flags, HELPER_ALIVE)) {
            debug(34, 3) ("dnsShutdownServers: #%d is NOT ALIVE.\n", dnsData->id);
            continue;
        }
-       if (dnsData->flags & DNS_FLAG_BUSY) {
+       if (EBIT_TEST(dnsData->flags, HELPER_BUSY)) {
            debug(34, 3) ("dnsShutdownServers: #%d is BUSY.\n", dnsData->id);
            continue;
        }
-       if (dnsData->flags & DNS_FLAG_CLOSING) {
+       if (EBIT_TEST(dnsData->flags, HELPER_CLOSING)) {
            debug(34, 3) ("dnsShutdownServers: #%d is CLOSING.\n", dnsData->id);
            continue;
        }
@@ -376,7 +376,7 @@ dnsShutdownServers(void)
            dnsShutdownRead,
            dnsData,
            0);
-       dnsData->flags |= DNS_FLAG_CLOSING;
+       EBIT_SET(dnsData->flags, HELPER_CLOSING);
     }
 }
 
@@ -384,7 +384,7 @@ static void
 dnsShutdownRead(int fd, void *data)
 {
     dnsserver_t *dnsData = data;
-    debug(14, dnsData->flags & DNS_FLAG_CLOSING ? 5 : 1)
+    debug(14, EBIT_TEST(dnsData->flags, HELPER_CLOSING) ? 5 : 1)
        ("FD %d: Connection from DNSSERVER #%d is closed, disabling\n",
        fd,
        dnsData->id);
index ab02cf309182956306377e78b2b7444baef57e9d..a6d5ed07e31981f092929c31442c1577598b2d97 100644 (file)
@@ -1,25 +1,26 @@
 
 
 typedef enum {
-    LOG_TAG_NONE,              /* 0 */
-    LOG_TCP_HIT,               /* 1 */
-    LOG_TCP_MISS,              /* 2 */
-    LOG_TCP_REFRESH_HIT,       /* 3 */
-    LOG_TCP_REFRESH_FAIL_HIT,  /* 4 */
-    LOG_TCP_REFRESH_MISS,      /* 5 */
-    LOG_TCP_CLIENT_REFRESH,    /* 6 */
-    LOG_TCP_IMS_HIT,           /* 7 */
-    LOG_TCP_IMS_MISS,          /* 8 */
-    LOG_TCP_SWAPFAIL_MISS,     /* 9 */
-    LOG_TCP_NEGATIVE_HIT,      /* 10 */
-    LOG_TCP_MEM_HIT,           /* 11 */
-    LOG_UDP_HIT,               /* 12 */
-    LOG_UDP_HIT_OBJ,           /* 13 */
-    LOG_UDP_MISS,              /* 14 */
-    LOG_UDP_DENIED,            /* 15 */
-    LOG_UDP_INVALID,           /* 16 */
-    LOG_UDP_MISS_NOFETCH,      /* 17 */
-    LOG_TYPE_MAX               /* 18 */
+    LOG_TAG_NONE,
+    LOG_TCP_HIT,
+    LOG_TCP_MISS,
+    LOG_TCP_REFRESH_HIT,
+    LOG_TCP_REFRESH_FAIL_HIT,
+    LOG_TCP_REFRESH_MISS,
+    LOG_TCP_CLIENT_REFRESH,
+    LOG_TCP_IMS_HIT,
+    LOG_TCP_IMS_MISS,
+    LOG_TCP_SWAPFAIL_MISS,
+    LOG_TCP_NEGATIVE_HIT,
+    LOG_TCP_MEM_HIT,
+    LOG_TCP_DENIED,
+    LOG_UDP_HIT,
+    LOG_UDP_HIT_OBJ,
+    LOG_UDP_MISS,
+    LOG_UDP_DENIED,
+    LOG_UDP_INVALID,
+    LOG_UDP_MISS_NOFETCH,
+    LOG_TYPE_MAX
 } log_type;
 
 typedef enum {
@@ -289,3 +290,71 @@ typedef enum {
     HTTP_GATEWAY_TIMEOUT = 504,
     HTTP_HTTP_VERSION_NOT_SUPPORTED = 505
 } http_status;
+
+enum {
+    ENTRY_SPECIAL,
+    ENTRY_UNUSED01,
+    ENTRY_REVALIDATE,
+    DELAY_SENDING,
+    ENTRY_UNUSED04,
+    RELEASE_REQUEST,
+    REFRESH_REQUEST,
+    ENTRY_CACHABLE,
+    ENTRY_UNUSED08,
+    ENTRY_UNUSED09,
+    ENTRY_UNUSED10,
+    ENTRY_DISPATCHED,
+    KEY_PRIVATE,
+    HIERARCHICAL,
+    ENTRY_NEGCACHED,
+    ENTRY_UNUSED15,
+    ENTRY_VALIDATED
+};
+
+
+enum {
+       HTTP_PROXYING,
+       HTTP_KEEPALIVE
+};
+
+enum {
+       ERR_FLAG_CBDATA
+};
+
+enum {
+    REQ_RANGE,
+    REQ_NOCACHE,
+    REQ_IMS,
+    REQ_AUTH,
+    REQ_CACHABLE,
+    REQ_UNUSED05,
+    REQ_HIERARCHICAL,
+    REQ_LOOPDETECT,
+    REQ_PROXY_KEEPALIVE,
+    REQ_PROXYING,
+    REQ_REFRESH,
+    REQ_USED_PROXY_AUTH
+};
+
+enum {
+    FD_CLOSE_REQUEST,
+    FD_WRITE_DAEMON,
+    FD_WRITE_PENDING,
+    FD_CLOSING,
+    FD_SOCKET_EOF
+};
+
+enum {
+    HELPER_ALIVE,
+    HELPER_BUSY,
+    HELPER_CLOSING
+};
+
+enum {
+    NEIGHBOR_PROXY_ONLY,
+    NEIGHBOR_NO_QUERY,
+    NEIGHBOR_DEFAULT_PARENT,
+    NEIGHBOR_ROUNDROBIN,
+    NEIGHBOR_MCAST_RESPONDER,
+    NEIGHBOR_CLOSEST_ONLY
+};
index d4c6ad10223af3a0506cf1c4ca26ab6d862308b4..b1151595ca1324b22936f8ce85ea276b15775c9d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.cc,v 1.100 1997/11/05 05:29:22 wessels Exp $
+ * $Id: errorpage.cc,v 1.101 1997/11/12 00:08:49 wessels Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
@@ -166,7 +166,7 @@ errorSend(int fd, ErrorState * err)
     debug(4, 3) ("errorSend: FD %d, err=%p\n", fd, err);
     assert(fd >= 0);
     buf = errorBuildBuf(err, &len);
-    BIT_SET(err->flags, ERR_FLAG_CBDATA);
+    EBIT_SET(err->flags, ERR_FLAG_CBDATA);
     cbdataAdd(err);
     comm_write(fd, xstrdup(buf), len, errorSendComplete, err, xfree);
 }
@@ -181,7 +181,7 @@ errorSend(int fd, ErrorState * err)
  *            closeing the FD, otherwise we do it ourseves.
  */
 static void
-errorSendComplete(int fd, char *bufnotused, int size, int errflag, void *data)
+errorSendComplete(int fd, char *bufnotused, size_t size, int errflag, void *data)
 {
     ErrorState *err = data;
     debug(4, 3) ("errorSendComplete: FD %d, size=%d\n", fd, size);
@@ -202,7 +202,7 @@ errorStateFree(ErrorState * err)
     safe_free(err->url);
     safe_free(err->host);
     safe_free(err->dnsserver_msg);
-    if (BIT_TEST(err->flags, ERR_FLAG_CBDATA))
+    if (EBIT_TEST(err->flags, ERR_FLAG_CBDATA))
        cbdataFree(err);
     else
        safe_free(err);
index c433b5ef043ffe59b660b63414fb5be7a3d8a587..7f967a547e81a8fcf96259baa5958f06b8c24cd0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fqdncache.cc,v 1.65 1997/11/05 05:29:23 wessels Exp $
+ * $Id: fqdncache.cc,v 1.66 1997/11/12 00:08:50 wessels Exp $
  *
  * DEBUG: section 35    FQDN Cache
  * AUTHOR: Harvest Derived
@@ -544,7 +544,7 @@ fqdncache_dnsHandleRead(int fd, void *data)
                dnsData, 0);
            return;
        }
-       debug(35, dnsData->flags & DNS_FLAG_CLOSING ? 5 : 1)
+       debug(35, EBIT_TEST(dnsData->flags, HELPER_CLOSING) ? 5 : 1)
            ("FD %d: Connection from DNSSERVER #%d is closed, disabling\n",
            fd, dnsData->id);
        dnsData->flags = 0;
@@ -586,7 +586,7 @@ fqdncache_dnsHandleRead(int fd, void *data)
     }
     if (dnsData->offset == 0) {
        dnsData->data = NULL;
-       dnsData->flags &= ~DNS_FLAG_BUSY;
+       EBIT_CLR(dnsData->flags, HELPER_BUSY);
     }
     /* reschedule */
     commSetSelect(dnsData->inpipe,
@@ -680,8 +680,7 @@ static void
 fqdncache_dnsDispatch(dnsserver_t * dns, fqdncache_entry * f)
 {
     char *buf = NULL;
-    if (!BIT_TEST(dns->flags, DNS_FLAG_ALIVE))
-       debug_trap("Dispatching a dead DNS server");
+    assert(EBIT_TEST(dns->flags, HELPER_ALIVE));
     if (!fqdncacheHasPending(f)) {
        debug(35, 0) ("fqdncache_dnsDispatch: skipping '%s' because no handler.\n",
            f->name);
@@ -693,7 +692,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);
-    dns->flags |= DNS_FLAG_BUSY;
+    EBIT_SET(dns->flags, HELPER_BUSY);
     dns->data = f;
     f->status = FQDN_DISPATCHED;
     comm_write(dns->outpipe,
index 1137b6159b743323bbc0806d4cb17c51a526f06b..76862c762f8eeef619a847fb6f7c946f0c9513cb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ftp.cc,v 1.166 1997/11/10 19:42:04 wessels Exp $
+ * $Id: ftp.cc,v 1.167 1997/11/12 00:08:50 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -633,6 +633,22 @@ ftpParseListing(FtpStateData * ftpState, int len)
     put_free_4k_page(line);
 }
 
+static void
+ftpReadComplete(FtpStateData * ftpState)
+{
+    /* Connection closed; retrieval done. */
+    if (EBIT_TEST(ftpState->flags, FTP_HTML_HEADER_SENT))
+       ftpListingFinish(ftpState);
+    storeTimestampsSet(ftpState->entry);
+    storeComplete(ftpState->entry);
+    /* expect the "transfer complete" message on the control socket */
+    commSetSelect(ftpState->ctrl.fd,
+       COMM_SELECT_READ,
+       ftpReadControlReply,
+       ftpState,
+       Config.Timeout.read);
+}
+
 static void
 ftpReadData(int fd, void *data)
 {
@@ -641,6 +657,7 @@ ftpReadData(int fd, void *data)
     int clen;
     int bin;
     StoreEntry *entry = ftpState->entry;
+    MemObject *mem = entry->mem_obj;
     ErrorState *err;
     assert(fd == ftpState->data.fd);
     if (protoAbortFetch(entry)) {
@@ -649,7 +666,7 @@ ftpReadData(int fd, void *data)
        return;
     }
     /* check if we want to defer reading */
-    clen = entry->mem_obj->inmem_hi;
+    clen = mem->inmem_hi;
     if (EBIT_TEST(ftpState->flags, FTP_ISDIR))
        if (!EBIT_TEST(ftpState->flags, FTP_HTML_HEADER_SENT))
            ftpListingStart(ftpState);
@@ -672,7 +689,7 @@ ftpReadData(int fd, void *data)
        if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
            commSetSelect(fd, COMM_SELECT_READ, ftpReadData, data, Config.Timeout.read);
        } else {
-           if (entry->mem_obj->inmem_hi == 0) {
+           if (mem->inmem_hi == 0) {
                err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR);
                err->xerrno = errno;
                err->request = requestLink(ftpState->request);
@@ -681,7 +698,7 @@ ftpReadData(int fd, void *data)
            storeAbort(entry, 0);
            ftpDataTransferDone(ftpState);
        }
-    } else if (len == 0 && entry->mem_obj->inmem_hi == 0) {
+    } else if (len == 0 && mem->inmem_hi == 0) {
        err = errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE);
        err->xerrno = errno;
        err->request = requestLink(ftpState->request);
@@ -689,17 +706,7 @@ ftpReadData(int fd, void *data)
        storeAbort(entry, 0);
        ftpDataTransferDone(ftpState);
     } else if (len == 0) {
-       /* Connection closed; retrieval done. */
-       if (EBIT_TEST(ftpState->flags, FTP_HTML_HEADER_SENT))
-           ftpListingFinish(ftpState);
-       storeTimestampsSet(entry);
-       storeComplete(entry);
-       /* expect the "transfer complete" message on the control socket */
-       commSetSelect(ftpState->ctrl.fd,
-           COMM_SELECT_READ,
-           ftpReadControlReply,
-           ftpState,
-           Config.Timeout.read);
+       ftpReadComplete(ftpState);
     } else {
        if (EBIT_TEST(ftpState->flags, FTP_ISDIR)) {
            ftpParseListing(ftpState, len);
@@ -707,7 +714,14 @@ ftpReadData(int fd, void *data)
            assert(ftpState->data.offset == 0);
            storeAppend(entry, ftpState->data.buf, len);
        }
-       commSetSelect(fd, COMM_SELECT_READ, ftpReadData, data, Config.Timeout.read);
+       if (mem->inmem_hi >= ftpState->size + mem->reply->hdr_sz)
+           ftpReadComplete(ftpState);
+       else
+           commSetSelect(fd,
+               COMM_SELECT_READ,
+               ftpReadData,
+               data,
+               Config.Timeout.read);
     }
 }
 
@@ -999,7 +1013,7 @@ ftpWriteCommand(const char *buf, FtpStateData * ftpState)
 }
 
 static void
-ftpWriteCommandCallback(int fd, char *bufnotused, int size, int errflag, void *data)
+ftpWriteCommandCallback(int fd, char *bufnotused, size_t size, int errflag, void *data)
 {
     FtpStateData *ftpState = data;
     StoreEntry *entry = ftpState->entry;
@@ -1592,7 +1606,7 @@ ftpAppendSuccessHeader(FtpStateData * ftpState)
        mime_type = mimeGetContentType(filename);
        mime_enc = mimeGetContentEncoding(filename);
     }
-    BIT_SET(e->flag, DELAY_SENDING);
+    EBIT_SET(e->flag, DELAY_SENDING);
     storeAppendPrintf(e, "HTTP/1.0 200 Gatewaying\r\n");
     reply->code = 200;
     reply->version = 1.0;
@@ -1614,7 +1628,7 @@ ftpAppendSuccessHeader(FtpStateData * ftpState)
        storeAppendPrintf(e, "Last-Modified: %s\r\n", mkrfc1123(ftpState->mdtm));
        reply->last_modified = ftpState->mdtm;
     }
-    BIT_CLR(e->flag, DELAY_SENDING);
+    EBIT_CLR(e->flag, DELAY_SENDING);
     storeAppendPrintf(e, "\r\n");
     reply->hdr_sz = e->mem_obj->inmem_hi;
     storeTimestampsSet(e);
index 48ad3205d2e315c0891dbb91006a669641385c61..31af70e483a031f9e6cc644e603b91e5b0011ad4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: gopher.cc,v 1.111 1997/11/05 05:29:26 wessels Exp $
+ * $Id: gopher.cc,v 1.112 1997/11/12 00:08:51 wessels Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -171,11 +171,7 @@ static void gopherEndHTML(GopherStateData *);
 static void gopherToHTML(GopherStateData *, char *inbuf, int len);
 static PF gopherTimeout;
 static PF gopherReadReply;
-static void gopherSendComplete(int fd,
-    char *buf,
-    int size,
-    int errflag,
-    void *data);
+static CWCB gopherSendComplete;
 static PF gopherSendRequest;
 static GopherStateData *CreateGopherStateData(void);
 static CNCB gopherConnectDone;
@@ -375,7 +371,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
            "<ISINDEX></BODY></HTML>\n", storeUrl(entry), storeUrl(entry));
        storeAppend(entry, outbuf, strlen(outbuf));
        /* now let start sending stuff to client */
-       BIT_CLR(entry->flag, DELAY_SENDING);
+       EBIT_CLR(entry->flag, DELAY_SENDING);
        gopherState->data_in = 1;
 
        return;
@@ -391,7 +387,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
 
        storeAppend(entry, outbuf, strlen(outbuf));
        /* now let start sending stuff to client */
-       BIT_CLR(entry->flag, DELAY_SENDING);
+       EBIT_CLR(entry->flag, DELAY_SENDING);
        gopherState->data_in = 1;
 
        return;
@@ -639,7 +635,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
     if ((int) strlen(outbuf) > 0) {
        storeAppend(entry, outbuf, strlen(outbuf));
        /* now let start sending stuff to client */
-       BIT_CLR(entry->flag, DELAY_SENDING);
+       EBIT_CLR(entry->flag, DELAY_SENDING);
     }
     return;
 }
@@ -724,7 +720,7 @@ gopherReadReply(int fd, void *data)
        if (gopherState->conversion != NORMAL)
            gopherEndHTML(data);
        storeTimestampsSet(entry);
-       BIT_CLR(entry->flag, DELAY_SENDING);
+       EBIT_CLR(entry->flag, DELAY_SENDING);
        storeComplete(entry);
        comm_close(fd);
     } else {
@@ -745,7 +741,7 @@ gopherReadReply(int fd, void *data)
 /* This will be called when request write is complete. Schedule read of
  * reply. */
 static void
-gopherSendComplete(int fd, char *buf, int size, int errflag, void *data)
+gopherSendComplete(int fd, char *buf, size_t size, int errflag, void *data)
 {
     GopherStateData *gopherState = (GopherStateData *) data;
     StoreEntry *entry = gopherState->entry;
@@ -774,19 +770,19 @@ gopherSendComplete(int fd, char *buf, int size, int errflag, void *data)
     switch (gopherState->type_id) {
     case GOPHER_DIRECTORY:
        /* we got to convert it first */
-       BIT_SET(entry->flag, DELAY_SENDING);
+       EBIT_SET(entry->flag, DELAY_SENDING);
        gopherState->conversion = HTML_DIR;
        gopherState->HTML_header_added = 0;
        break;
     case GOPHER_INDEX:
        /* we got to convert it first */
-       BIT_SET(entry->flag, DELAY_SENDING);
+       EBIT_SET(entry->flag, DELAY_SENDING);
        gopherState->conversion = HTML_INDEX_RESULT;
        gopherState->HTML_header_added = 0;
        break;
     case GOPHER_CSO:
        /* we got to convert it first */
-       BIT_SET(entry->flag, DELAY_SENDING);
+       EBIT_SET(entry->flag, DELAY_SENDING);
        gopherState->conversion = HTML_CSO_RESULT;
        gopherState->cso_recno = 0;
        gopherState->HTML_header_added = 0;
@@ -826,7 +822,7 @@ gopherSendRequest(int fd, void *data)
        gopherSendComplete,
        data,
        put_free_4k_page);
-    if (BIT_TEST(gopherState->entry->flag, ENTRY_CACHABLE))
+    if (EBIT_TEST(gopherState->entry->flag, ENTRY_CACHABLE))
        storeSetPublicKey(gopherState->entry);  /* Make it public */
 }
 
index cbc8030191f9bc99108c0c8b55193bcac0e94953..9336fb4e106a1c0a558d22d37374566121ee41e8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.219 1997/11/10 21:32:00 wessels Exp $
+ * $Id: http.cc,v 1.220 1997/11/12 00:08:52 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -254,7 +254,7 @@ httpTimeout(int fd, void *data)
     assert(entry->store_status == STORE_PENDING);
     if (entry->mem_obj->inmem_hi == 0) {
        err = errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT);
-       err->request = requestLink(httpState->request);
+       err->request = requestLink(httpState->orig_request);
        errorAppendEntry(entry, err);
     }
     storeAbort(entry, 0);
@@ -265,7 +265,7 @@ httpTimeout(int fd, void *data)
 static void
 httpMakePublic(StoreEntry * entry)
 {
-    if (BIT_TEST(entry->flag, ENTRY_CACHABLE))
+    if (EBIT_TEST(entry->flag, ENTRY_CACHABLE))
        storeSetPublicKey(entry);
 }
 
@@ -274,7 +274,7 @@ static void
 httpMakePrivate(StoreEntry * entry)
 {
     storeExpireNow(entry);
-    BIT_CLR(entry->flag, ENTRY_CACHABLE);
+    EBIT_CLR(entry->flag, ENTRY_CACHABLE);
     storeReleaseRequest(entry);        /* delete object when not used */
 }
 
@@ -283,7 +283,7 @@ static void
 httpCacheNegatively(StoreEntry * entry)
 {
     storeNegativeCache(entry);
-    if (BIT_TEST(entry->flag, ENTRY_CACHABLE))
+    if (EBIT_TEST(entry->flag, ENTRY_CACHABLE))
        storeSetPublicKey(entry);
 }
 
@@ -427,7 +427,7 @@ httpCachableReply(HttpStateData * httpState)
        return 0;
     if (EBIT_TEST(reply->cache_control, SCC_NOCACHE))
        return 0;
-    if (BIT_TEST(httpState->request->flags, REQ_AUTH))
+    if (EBIT_TEST(httpState->request->flags, REQ_AUTH))
        if (!EBIT_TEST(reply->cache_control, SCC_PROXYREVALIDATE))
            return 0;
     /*
@@ -552,7 +552,7 @@ httpProcessReplyHeader(HttpStateData * httpState, const char *buf, int size)
            break;
        }
        if (EBIT_TEST(reply->cache_control, SCC_PROXYREVALIDATE))
-           BIT_SET(entry->flag, ENTRY_REVALIDATE);
+           EBIT_SET(entry->flag, ENTRY_REVALIDATE);
        if (EBIT_TEST(reply->misc_headers, HDR_PROXY_KEEPALIVE))
            if (httpState->peer)
                httpState->peer->stats.n_keepalives_recv++;
@@ -566,7 +566,7 @@ httpPconnTransferDone(HttpStateData * httpState)
     MemObject *mem = httpState->entry->mem_obj;
     struct _http_reply *reply = mem->reply;
     debug(11, 3) ("httpPconnTransferDone: FD %d\n", httpState->fd);
-    if (!BIT_TEST(httpState->flags, HTTP_KEEPALIVE))
+    if (!EBIT_TEST(httpState->flags, HTTP_KEEPALIVE))
        return 0;
     debug(11, 5) ("httpPconnTransferDone: content_length=%d\n",
        reply->content_length);
@@ -633,7 +633,7 @@ httpReadReply(int fd, void *data)
            if (clen == 0) {
                err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR);
                err->xerrno = errno;
-               err->request = requestLink(httpState->request);
+               err->request = requestLink(httpState->orig_request);
                errorAppendEntry(entry, err);
            }
            storeAbort(entry, 0);
@@ -648,7 +648,7 @@ httpReadReply(int fd, void *data)
            httpState->eof = 1;
            err = errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE);
            err->xerrno = errno;
-           err->request = requestLink(httpState->request);
+           err->request = requestLink(httpState->orig_request);
            errorAppendEntry(entry, err);
            storeAbort(entry, 0);
            comm_close(fd);
@@ -683,7 +683,7 @@ httpReadReply(int fd, void *data)
 /* This will be called when request write is complete. Schedule read of
  * reply. */
 static void
-httpSendComplete(int fd, char *bufnotused, int size, int errflag, void *data)
+httpSendComplete(int fd, char *bufnotused, size_t size, int errflag, void *data)
 {
     HttpStateData *httpState = data;
     StoreEntry *entry = httpState->entry;
@@ -695,7 +695,7 @@ httpSendComplete(int fd, char *bufnotused, int size, int errflag, void *data)
     if (errflag) {
        err = errorCon(ERR_WRITE_ERROR, HTTP_INTERNAL_SERVER_ERROR);
        err->xerrno = errno;
-       err->request = requestLink(httpState->request);
+       err->request = requestLink(httpState->orig_request);
        errorAppendEntry(entry, err);
        storeAbort(entry, 0);
        comm_close(fd);
@@ -785,7 +785,7 @@ httpBuildRequestHeader(request_t * request,
            continue;
        if (strncasecmp(xbuf, "Proxy-authorization:", 20) == 0)
            /* If we're not going to do proxy auth, then it must be passed on */
-           if (BIT_TEST(request->flags, REQ_USED_PROXY_AUTH))
+           if (EBIT_TEST(request->flags, REQ_USED_PROXY_AUTH))
                continue;
        if (strncasecmp(xbuf, "Connection:", 11) == 0)
            continue;
@@ -844,8 +844,8 @@ httpBuildRequestHeader(request_t * request,
            assert(strstr(url, request->urlpath));
     }
     /* maybe append Connection: Keep-Alive */
-    if (BIT_TEST(flags, HTTP_KEEPALIVE)) {
-       if (BIT_TEST(flags, HTTP_PROXYING)) {
+    if (EBIT_TEST(flags, HTTP_KEEPALIVE)) {
+       if (EBIT_TEST(flags, HTTP_PROXYING)) {
            snprintf(ybuf, YBUF_SZ, "Proxy-Connection: Keep-Alive");
        } else {
            snprintf(ybuf, YBUF_SZ, "Connection: Keep-Alive");
@@ -906,19 +906,19 @@ httpSendRequest(int fd, void *data)
     else
        cfd = entry->mem_obj->fd;
     if (p != NULL)
-       BIT_SET(httpState->flags, HTTP_PROXYING);
+       EBIT_SET(httpState->flags, HTTP_PROXYING);
     if (req->method == METHOD_GET) {
        if (p) {
            d = (double) p->stats.n_keepalives_recv /
                (double) ++p->stats.n_keepalives_sent;
            if (d > 0.50 || p->stats.n_keepalives_sent < 10)
-               BIT_SET(httpState->flags, HTTP_KEEPALIVE);
+               EBIT_SET(httpState->flags, HTTP_KEEPALIVE);
        } else {
-           BIT_SET(httpState->flags, HTTP_KEEPALIVE);
+           EBIT_SET(httpState->flags, HTTP_KEEPALIVE);
        }
     }
     len = httpBuildRequestHeader(req,
-       httpState->orig_request ? httpState->orig_request : req,
+       httpState->orig_request,
        entry,
        NULL,
        buf,
@@ -950,11 +950,10 @@ httpSocketOpen(StoreEntry * entry, request_t * request)
        COMM_NONBLOCKING,
        storeUrl(entry));
     if (fd < 0) {
-       debug(11, 4) ("httpSocketOpen: Failed because we're out of sockets.\n");
+       debug(50, 4) ("httpSocketOpen: %s\n", xstrerror());
        err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
        err->xerrno = errno;
-       if (request)
-           err->request = requestLink(request);
+       err->request = requestLink(request);
        errorAppendEntry(entry, err);
        storeAbort(entry, 0);
     }
@@ -979,9 +978,10 @@ httpBuildState(int fd, StoreEntry * entry, request_t * orig_request, peer * e)
        httpState->request = requestLink(request);
        httpState->peer = e;
        httpState->orig_request = requestLink(orig_request);
-       BIT_SET(request->flags, REQ_PROXYING);
+       EBIT_SET(request->flags, REQ_PROXYING);
     } else {
        httpState->request = requestLink(orig_request);
+       httpState->orig_request = requestLink(orig_request);
     }
     /* register the handler to free HTTP state data when the FD closes */
     comm_add_close_handler(httpState->fd, httpStateFree, httpState);
@@ -1021,7 +1021,7 @@ httpStart(request_t * request, StoreEntry * entry, peer * e)
            return;
        }
     }
-    if ((fd = httpSocketOpen(entry, NULL)) < 0)
+    if ((fd = httpSocketOpen(entry, request)) < 0)
        return;
     httpState = httpBuildState(fd, entry, request, e);
     commSetTimeout(httpState->fd,
@@ -1045,7 +1045,7 @@ httpRestart(HttpStateData * httpState)
        comm_close(httpState->fd);
        httpState->fd = -1;
     }
-    httpState->fd = httpSocketOpen(httpState->entry, httpState->request);
+    httpState->fd = httpSocketOpen(httpState->entry, httpState->orig_request);
     if (httpState->fd < 0)
        return;
     comm_add_close_handler(httpState->fd, httpStateFree, httpState);
@@ -1071,7 +1071,7 @@ httpConnectDone(int fd, int status, void *data)
        debug(11, 4) ("httpConnectDone: Unknown host: %s\n", request->host);
        err = errorCon(ERR_DNS_FAIL, HTTP_SERVICE_UNAVAILABLE);
        err->dnsserver_msg = xstrdup(dns_error_message);
-       err->request = requestLink(request);
+       err->request = requestLink(httpState->orig_request);
        errorAppendEntry(entry, err);
        storeAbort(entry, 0);
        comm_close(fd);
@@ -1080,7 +1080,7 @@ httpConnectDone(int fd, int status, void *data)
        err->xerrno = errno;
        err->host = xstrdup(request->host);
        err->port = request->port;
-       err->request = requestLink(request);
+       err->request = requestLink(httpState->orig_request);
        errorAppendEntry(entry, err);
        storeAbort(entry, 0);
        if (httpState->peer)
index 13f80edeade3d88294b2e1261d7992c3fbbad768..88f76af35814ad973e429effffd47fd02c43d21f 100644 (file)
@@ -189,7 +189,7 @@ icpCheckUdpHit(StoreEntry * e, request_t * request)
 int
 icpCheckUdpHitObj(StoreEntry * e, request_t * r, icp_common_t * h, int len)
 {
-    if (!BIT_TEST(h->flags, ICP_FLAG_HIT_OBJ)) /* not requested */
+    if (!(h->flags & ICP_FLAG_HIT_OBJ))        /* not requested */
        return 0;
     if (len > Config.udpMaxHitObjsz)   /* too big */
        return 0;
index c4bb1776479828ecc30837dc4f213d108ced0c23..199c7d530e8deae28a710bd3117ae44b261afd78 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ident.cc,v 1.36 1997/11/05 05:29:29 wessels Exp $
+ * $Id: ident.cc,v 1.37 1997/11/12 00:08:54 wessels Exp $
  *
  * DEBUG: section 30    Ident (RFC 931)
  * AUTHOR: Duane Wessels
@@ -33,7 +33,6 @@
 
 #define IDENT_PORT 113
 
-static CWCB identRequestComplete;
 static PF identReadReply;
 static PF identClose;
 static CNCB identConnectDone;
@@ -88,27 +87,8 @@ identConnectDone(int fd, int status, void *data)
     snprintf(reqbuf, BUFSIZ, "%d, %d\r\n",
        ntohs(connState->peer.sin_port),
        ntohs(connState->me.sin_port));
-    comm_write(fd,
-       reqbuf,
-       strlen(reqbuf),
-       identRequestComplete,
-       connState,
-       NULL);
-    commSetSelect(fd,
-       COMM_SELECT_READ,
-       identReadReply,
-       connState, 0);
-}
-
-static void
-identRequestComplete(
-    int fd,
-    char *bufnotused,
-    int size,
-    int flagnotused,
-    void *datanotused)
-{
-    debug(30, 5) ("identRequestComplete: FD %d: wrote %d bytes\n", fd, size);
+    comm_write(fd, xstrdup(reqbuf), strlen(reqbuf), NULL, connState, xfree);
+    commSetSelect(fd, COMM_SELECT_READ, identReadReply, connState, 0);
 }
 
 static void
index d2561274bf46c5d3035b8ded3a4679daf50bbee5..73fa0d95454fa49091d5eefcf2973f8b883e3f43 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ipcache.cc,v 1.141 1997/11/05 05:29:30 wessels Exp $
+ * $Id: ipcache.cc,v 1.142 1997/11/12 00:08:55 wessels Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -588,7 +588,7 @@ ipcache_dnsHandleRead(int fd, void *data)
                0);
            return;
        }
-       debug(14, dnsData->flags & DNS_FLAG_CLOSING ? 5 : 1)
+       debug(14, EBIT_TEST(dnsData->flags, HELPER_CLOSING) ? 5 : 1)
            ("FD %d: Connection from DNSSERVER #%d is closed, disabling\n",
            fd, dnsData->id);
        dnsData->flags = 0;
@@ -637,7 +637,7 @@ ipcache_dnsHandleRead(int fd, void *data)
     }
     if (dnsData->offset == 0) {
        dnsData->data = NULL;
-       dnsData->flags &= ~DNS_FLAG_BUSY;
+       EBIT_CLR(dnsData->flags, HELPER_BUSY);
     }
     ipcacheNudgeQueue();
 }
@@ -731,7 +731,7 @@ static void
 ipcache_dnsDispatch(dnsserver_t * dns, ipcache_entry * i)
 {
     char *buf = NULL;
-    assert(BIT_TEST(dns->flags, DNS_FLAG_ALIVE));
+    assert(EBIT_TEST(dns->flags, HELPER_ALIVE));
     if (!ipcacheHasPending(i)) {
        debug(14, 0) ("Skipping lookup of '%s' because client(s) disappeared.\n",
            i->name);
@@ -742,7 +742,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);
-    dns->flags |= DNS_FLAG_BUSY;
+    EBIT_SET(dns->flags , HELPER_BUSY);
     dns->data = i;
     i->status = IP_DISPATCHED;
     comm_write(dns->outpipe,
index 006d4f3504f62fd9f413af801b24325788abc9e1..a55df6a6466db50111244a279411bc99e94fae4a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: mime.cc,v 1.42 1997/11/03 22:43:15 wessels Exp $
+ * $Id: mime.cc,v 1.43 1997/11/12 00:08:56 wessels Exp $
  *
  * DEBUG: section 25    MIME Parsing
  * AUTHOR: Harvest Derived
@@ -436,7 +436,7 @@ mimeLoadIconFile(const char *icon)
     storeSetPublicKey(e);
     storeComplete(e);
     storeTimestampsSet(e);
-    BIT_SET(e->flag, ENTRY_SPECIAL);
+    EBIT_SET(e->flag, ENTRY_SPECIAL);
     debug(25, 3) ("Loaded icon %s\n", url);
     storeUnlockObject(e);
     put_free_4k_page(buf);
index 09392cdf9e4e86cd0e57d6c25cef49c68aad41a8..a949620fb368ccc237d5c7e14adf22e4b0f5c4fa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: neighbors.cc,v 1.166 1997/11/05 05:29:31 wessels Exp $
+ * $Id: neighbors.cc,v 1.167 1997/11/12 00:08:58 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -190,10 +190,10 @@ peerAllowedToUse(const peer * p, request_t * request)
     aclCheck_t checklist;
     if (request == NULL)
        fatal_dump("peerAllowedToUse: NULL request");
-    if (BIT_TEST(request->flags, REQ_NOCACHE))
+    if (EBIT_TEST(request->flags, REQ_NOCACHE))
        if (neighborType(p, request) == PEER_SIBLING)
            return 0;
-    if (BIT_TEST(request->flags, REQ_REFRESH))
+    if (EBIT_TEST(request->flags, REQ_REFRESH))
        if (neighborType(p, request) == PEER_SIBLING)
            return 0;
     if (p->pinglist == NULL && p->acls == NULL)
@@ -227,7 +227,7 @@ peerWouldBePinged(const peer * p, request_t * request)
     /* the case below seems strange, but can happen if the
      * URL host is on the other side of a firewall */
     if (p->type == PEER_SIBLING)
-       if (!BIT_TEST(request->flags, REQ_HIERARCHICAL))
+       if (!EBIT_TEST(request->flags, REQ_HIERARCHICAL))
            return 0;
     if (p->icp_port == echo_port)
        if (!neighborUp(p))
@@ -301,7 +301,7 @@ getRoundRobinParent(request_t * request)
     peer *p;
     peer *q = NULL;
     for (p = Config.peers; p; p = p->next) {
-       if (!BIT_TEST(p->options, NEIGHBOR_ROUNDROBIN))
+       if (!EBIT_TEST(p->options, NEIGHBOR_ROUNDROBIN))
            continue;
        if (neighborType(p, request) != PEER_PARENT)
            continue;
@@ -324,7 +324,7 @@ getDefaultParent(request_t * request)
     for (p = Config.peers; p; p = p->next) {
        if (neighborType(p, request) != PEER_PARENT)
            continue;
-       if (!BIT_TEST(p->options, NEIGHBOR_DEFAULT_PARENT))
+       if (!EBIT_TEST(p->options, NEIGHBOR_DEFAULT_PARENT))
            continue;
        if (!peerHTTPOkay(p, request))
            continue;
@@ -452,7 +452,7 @@ neighborsUdpPing(request_t * request,
            flags = 0;
            /* check if we should set ICP_FLAG_HIT_OBJ */
            if (opt_udp_hit_obj)
-               if (!BIT_TEST(request->flags, REQ_NOCACHE))
+               if (!EBIT_TEST(request->flags, REQ_NOCACHE))
                    if (p->icp_version == ICP_VERSION_2)
                        flags |= ICP_FLAG_HIT_OBJ;
            if (Config.onoff.query_icmp)
@@ -604,7 +604,7 @@ ignoreMulticastReply(peer * p, MemObject * mem)
 {
     if (p == NULL)
        return 0;
-    if (!BIT_TEST(p->options, NEIGHBOR_MCAST_RESPONDER))
+    if (!EBIT_TEST(p->options, NEIGHBOR_MCAST_RESPONDER))
        return 0;
     if (peerHTTPOkay(p, mem->request))
        return 0;
@@ -633,7 +633,7 @@ neighborsUdpAck(const char *url, icp_common_t * header, const struct sockaddr_in
        return;
     opcode_d = IcpOpcodeStr[opcode];
     /* check if someone is already fetching it */
-    if (BIT_TEST(entry->flag, ENTRY_DISPATCHED)) {
+    if (EBIT_TEST(entry->flag, ENTRY_DISPATCHED)) {
        debug(15, 3) ("neighborsUdpAck: '%s' already being fetched.\n", url);
        neighborCountIgnored(p, opcode);
        return;
index b30117cd18550b637d6398898df8bf5f059f1ede..6c19fcc0ed83ff3e4914f538809278375e3256c4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_select.cc,v 1.31 1997/11/04 06:16:52 wessels Exp $
+ * $Id: peer_select.cc,v 1.32 1997/11/12 00:09:01 wessels Exp $
  *
  * DEBUG: section 44    Peer Selection Algorithm
  * AUTHOR: Duane Wessels
@@ -94,12 +94,12 @@ peerSelectIcpPing(request_t * request, int direct, StoreEntry * entry)
        return 0;
     if (direct == DIRECT_YES)
        fatal_dump("direct == DIRECT_YES");
-    if (!BIT_TEST(entry->flag, HIERARCHICAL) && direct != DIRECT_NO)
+    if (!EBIT_TEST(entry->flag, HIERARCHICAL) && direct != DIRECT_NO)
        return 0;
     if (Config.onoff.single_parent_bypass && !Config.onoff.source_ping)
        if (getSingleParent(request))
            return 0;
-    if (BIT_TEST(entry->flag, KEY_PRIVATE) && !neighbors_do_private_keys)
+    if (EBIT_TEST(entry->flag, KEY_PRIVATE) && !neighbors_do_private_keys)
        if (direct != DIRECT_NO)
            return 0;
     n = neighborsCount(request);
@@ -354,7 +354,7 @@ peerIcpParentMiss(peer * p, icp_common_t * header, ps_state * ps)
     int rtt;
     int hops;
     if (Config.onoff.query_icmp) {
-       if (BIT_TEST(header->flags, ICP_FLAG_SRC_RTT)) {
+       if (header->flags & ICP_FLAG_SRC_RTT) {
            rtt = header->pad & 0xFFFF;
            hops = (header->pad >> 16) & 0xFFFF;
            if (rtt > 0 && rtt < 0xFFFF)
@@ -366,7 +366,7 @@ peerIcpParentMiss(peer * p, icp_common_t * header, ps_state * ps)
        }
     }
     /* if closest-only is set, the don't allow FIRST_PARENT_MISS */
-    if (BIT_TEST(p->options, NEIGHBOR_CLOSEST_ONLY))
+    if (EBIT_TEST(p->options, NEIGHBOR_CLOSEST_ONLY))
        return;
     /* set FIRST_MISS if thre is no CLOSEST parent */
     if (ps->closest_parent_miss != NULL)
index 44b8e093d08f376599ac539e148ce763adbee5d4..25576a1e2a10059f12e497632c3b7ef41bd12635 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: redirect.cc,v 1.48 1997/10/25 17:22:57 wessels Exp $
+ * $Id: redirect.cc,v 1.49 1997/11/12 00:09:03 wessels Exp $
  *
  * DEBUG: section 29    Redirector
  * AUTHOR: Duane Wessels
 
 #include "squid.h"
 
-#define REDIRECT_FLAG_ALIVE            0x01
-#define REDIRECT_FLAG_BUSY             0x02
-#define REDIRECT_FLAG_CLOSING          0x04
-
 typedef struct {
     void *data;
     char *orig_url;
@@ -180,7 +176,7 @@ redirectHandleRead(int fd, void *data)
     if (len <= 0) {
        if (len < 0)
            debug(50, 1) ("redirectHandleRead: FD %d read: %s\n", fd, xstrerror());
-       debug(29, redirector->flags & REDIRECT_FLAG_CLOSING ? 5 : 1)
+       debug(29, EBIT_TEST(redirector->flags, HELPER_CLOSING) ? 5 : 1)
            ("FD %d: Connection from Redirector #%d is closed, disabling\n",
            fd, redirector->index + 1);
        redirector->flags = 0;
@@ -223,7 +219,7 @@ redirectHandleRead(int fd, void *data)
            }
            redirectStateFree(r);
            redirector->redirectState = NULL;
-           redirector->flags &= ~REDIRECT_FLAG_BUSY;
+           EBIT_CLR(redirector->flags, HELPER_BUSY);
            redirector->offset = 0;
            n = ++RedirectStats.replies;
            RedirectStats.avg_svc_time =
@@ -270,9 +266,9 @@ GetFirstAvailable(void)
     redirector_t *redirect = NULL;
     for (k = 0; k < NRedirectors; k++) {
        redirect = *(redirect_child_table + k);
-       if (BIT_TEST(redirect->flags, REDIRECT_FLAG_BUSY))
+       if (EBIT_TEST(redirect->flags, HELPER_BUSY))
            continue;
-       if (!BIT_TEST(redirect->flags, REDIRECT_FLAG_ALIVE))
+       if (!EBIT_TEST(redirect->flags, HELPER_ALIVE))
            continue;
        return redirect;
     }
@@ -299,7 +295,7 @@ redirectDispatch(redirector_t * redirect, redirectStateData * r)
        redirectStateFree(r);
        return;
     }
-    redirect->flags |= REDIRECT_FLAG_BUSY;
+    EBIT_SET(redirect->flags, HELPER_BUSY);
     redirect->redirectState = r;
     redirect->dispatch_time = current_time;
     if ((fqdn = fqdncache_gethostbyaddr(r->client_addr, 0)) == NULL)
@@ -396,9 +392,9 @@ redirectOpenServers(void)
        redirect_child_table[k] = xcalloc(1, sizeof(redirector_t));
        if ((redirectsocket = redirectCreateRedirector(prg)) < 0) {
            debug(29, 1) ("WARNING: Cannot run '%s' process.\n", prg);
-           redirect_child_table[k]->flags &= ~REDIRECT_FLAG_ALIVE;
+           EBIT_CLR(redirect_child_table[k]->flags, HELPER_ALIVE);
        } else {
-           redirect_child_table[k]->flags |= REDIRECT_FLAG_ALIVE;
+           EBIT_SET(redirect_child_table[k]->flags, HELPER_ALIVE);
            redirect_child_table[k]->index = k;
            redirect_child_table[k]->fd = redirectsocket;
            redirect_child_table[k]->inbuf = get_free_8k_page();
@@ -443,17 +439,17 @@ redirectShutdownServers(void)
     }
     for (k = 0; k < NRedirectors; k++) {
        redirect = *(redirect_child_table + k);
-       if (!(redirect->flags & REDIRECT_FLAG_ALIVE))
+       if (!EBIT_TEST(redirect->flags, HELPER_ALIVE))
            continue;
-       if (redirect->flags & REDIRECT_FLAG_BUSY)
+       if (EBIT_TEST(redirect->flags, HELPER_BUSY))
            continue;
-       if (redirect->flags & REDIRECT_FLAG_CLOSING)
+       if (EBIT_TEST(redirect->flags, HELPER_CLOSING))
            continue;
        debug(29, 3) ("redirectShutdownServers: closing redirector #%d, FD %d\n",
            redirect->index + 1, redirect->fd);
        comm_close(redirect->fd);
-       redirect->flags |= REDIRECT_FLAG_CLOSING;
-       redirect->flags |= REDIRECT_FLAG_BUSY;
+       EBIT_SET(redirect->flags, HELPER_CLOSING);
+       EBIT_SET(redirect->flags, HELPER_BUSY);
     }
 }
 
index 26b1f1c1a781ca9643d5594ce9a2cc7771f3ad92..7f5dc0b386298fcfa44ff1968402fc156b4cb295 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: refresh.cc,v 1.16 1997/11/03 22:43:19 wessels Exp $
+ * $Id: refresh.cc,v 1.17 1997/11/12 00:09:04 wessels Exp $
  *
  * DEBUG: section 22    Refresh Calculation
  * AUTHOR: Harvest Derived
@@ -61,7 +61,7 @@ refreshCheck(const StoreEntry * entry, const request_t * request, time_t delta)
     int factor;
     time_t check_time = squid_curtime + delta;
     debug(22, 3) ("refreshCheck: '%s'\n", storeUrl(entry));
-    if (BIT_TEST(entry->flag, ENTRY_REVALIDATE)) {
+    if (EBIT_TEST(entry->flag, ENTRY_REVALIDATE)) {
        debug(22, 3) ("refreshCheck: YES: Required Authorization\n");
        return 1;
     }
index ce719a81f8b4d84da21ef7de80edda2530cee8b1..aa060e230dae781df97ebc93b837002cf971af54 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ssl.cc,v 1.69 1997/11/05 05:29:36 wessels Exp $
+ * $Id: ssl.cc,v 1.70 1997/11/12 00:09:05 wessels Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -306,7 +306,7 @@ sslConnected(int fd, void *data)
 }
 
 static void
-sslErrorComplete(int fdnotused, void *sslState, int sizenotused)
+sslErrorComplete(int fdnotused, void *sslState, size_t sizenotused)
 {
     assert(sslState != NULL);
     sslClose(sslState);
index 559492edf17711bbc7ba53e981285dbc4160a662..c06c0cf5c155cfd8faa09d5d2b9a29c6c72c4031 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.168 1997/11/05 05:29:37 wessels Exp $
+ * $Id: stat.cc,v 1.169 1997/11/12 00:09:06 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -287,21 +287,21 @@ describeFlags(const StoreEntry * entry)
     int flags = (int) entry->flag;
     char *t;
     buf[0] = '\0';
-    if (BIT_TEST(flags, DELAY_SENDING))
+    if (EBIT_TEST(flags, DELAY_SENDING))
        strcat(buf, "DS,");
-    if (BIT_TEST(flags, RELEASE_REQUEST))
+    if (EBIT_TEST(flags, RELEASE_REQUEST))
        strcat(buf, "RL,");
-    if (BIT_TEST(flags, REFRESH_REQUEST))
+    if (EBIT_TEST(flags, REFRESH_REQUEST))
        strcat(buf, "RF,");
-    if (BIT_TEST(flags, ENTRY_CACHABLE))
+    if (EBIT_TEST(flags, ENTRY_CACHABLE))
        strcat(buf, "EC,");
-    if (BIT_TEST(flags, ENTRY_DISPATCHED))
+    if (EBIT_TEST(flags, ENTRY_DISPATCHED))
        strcat(buf, "ED,");
-    if (BIT_TEST(flags, KEY_PRIVATE))
+    if (EBIT_TEST(flags, KEY_PRIVATE))
        strcat(buf, "KP,");
-    if (BIT_TEST(flags, HIERARCHICAL))
+    if (EBIT_TEST(flags, HIERARCHICAL))
        strcat(buf, "HI,");
-    if (BIT_TEST(flags, ENTRY_NEGCACHED))
+    if (EBIT_TEST(flags, ENTRY_NEGCACHED))
        strcat(buf, "NG,");
     if ((t = strrchr(buf, ',')))
        *t = '\0';
@@ -336,7 +336,7 @@ statObjects(StoreEntry * sentry, int vm_or_not)
        if ((++N & 0xFF) == 0) {
            debug(18, 3) ("stat_objects_get:  Processed %d objects...\n", N);
        }
-       BIT_SET(sentry->flag, DELAY_SENDING);
+       EBIT_SET(sentry->flag, DELAY_SENDING);
        storeAppendPrintf(sentry, "KEY %s\n", storeKeyText(entry->key));
        storeAppendPrintf(sentry, "\t%s %s\n",
            RequestMethodStr[entry->method], storeUrl(entry));
@@ -371,7 +371,7 @@ statObjects(StoreEntry * sentry, int vm_or_not)
            storeAppendPrintf(sentry, "\t\tswapin_fd: %d\n",
                (int) sc->swapin_fd);
        }
-       BIT_CLR(sentry->flag, DELAY_SENDING);
+       EBIT_CLR(sentry->flag, DELAY_SENDING);
        storeAppendPrintf(sentry, "\n");
     }
 }
index 940a97f19c8b974532f4d3fa9f508981a8778519..6986fbcba5036dfbd69e2e03f9383e3e722bd8a4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.337 1997/11/10 20:54:33 wessels Exp $
+ * $Id: store.cc,v 1.338 1997/11/12 00:09:09 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -459,12 +459,12 @@ storeLockObject(StoreEntry * e)
 void
 storeReleaseRequest(StoreEntry * e)
 {
-    if (BIT_TEST(e->flag, RELEASE_REQUEST))
+    if (EBIT_TEST(e->flag, RELEASE_REQUEST))
        return;
     if (!storeEntryLocked(e))
        fatal_dump("storeReleaseRequest: unlocked entry");
     debug(20, 3) ("storeReleaseRequest: '%s'\n", storeKeyText(e->key));
-    BIT_SET(e->flag, RELEASE_REQUEST);
+    EBIT_SET(e->flag, RELEASE_REQUEST);
     storeSetPrivateKey(e);
 }
 
@@ -479,11 +479,11 @@ storeUnlockObject(StoreEntry * e)
     if (e->lock_count)
        return (int) e->lock_count;
     if (e->store_status == STORE_PENDING) {
-       assert(!BIT_TEST(e->flag, ENTRY_DISPATCHED));
-       BIT_SET(e->flag, RELEASE_REQUEST);
+       assert(!EBIT_TEST(e->flag, ENTRY_DISPATCHED));
+       EBIT_SET(e->flag, RELEASE_REQUEST);
     }
     assert(storePendingNClients(e) == 0);
-    if (BIT_TEST(e->flag, RELEASE_REQUEST))
+    if (EBIT_TEST(e->flag, RELEASE_REQUEST))
        storeRelease(e);
     else if (storeKeepInMemory(e)) {
        storeSetMemStatus(e, IN_MEMORY);
@@ -517,7 +517,7 @@ storeSetPrivateKey(StoreEntry * e)
 {
     const cache_key *newkey;
     MemObject *mem = e->mem_obj;
-    if (e->key && BIT_TEST(e->flag, KEY_PRIVATE))
+    if (e->key && EBIT_TEST(e->flag, KEY_PRIVATE))
        return;                 /* is already private */
     if (e->key)
        storeHashDelete(e);
@@ -529,7 +529,7 @@ storeSetPrivateKey(StoreEntry * e)
     }
     assert(hash_lookup(store_table, newkey) == NULL);
     storeHashInsert(e, newkey);
-    BIT_SET(e->flag, KEY_PRIVATE);
+    EBIT_SET(e->flag, KEY_PRIVATE);
 }
 
 void
@@ -538,7 +538,7 @@ storeSetPublicKey(StoreEntry * e)
     StoreEntry *e2 = NULL;
     const cache_key *newkey;
     MemObject *mem = e->mem_obj;
-    if (e->key && !BIT_TEST(e->flag, KEY_PRIVATE))
+    if (e->key && !EBIT_TEST(e->flag, KEY_PRIVATE))
        return;                 /* is already public */
     assert(mem);
     newkey = storeKeyPublic(mem->url, e->method);
@@ -551,7 +551,7 @@ storeSetPublicKey(StoreEntry * e)
     if (e->key)
        storeHashDelete(e);
     storeHashInsert(e, newkey);
-    BIT_CLR(e->flag, KEY_PRIVATE);
+    EBIT_CLR(e->flag, KEY_PRIVATE);
 }
 
 StoreEntry *
@@ -565,21 +565,21 @@ storeCreateEntry(const char *url, const char *log_url, int flags, method_t metho
     e->lock_count = 1;         /* Note lock here w/o calling storeLock() */
     mem = e->mem_obj;
     e->method = method;
-    if (neighbors_do_private_keys || !BIT_TEST(flags, REQ_HIERARCHICAL))
+    if (neighbors_do_private_keys || !EBIT_TEST(flags, REQ_HIERARCHICAL))
        storeSetPrivateKey(e);
     else
        storeSetPublicKey(e);
-    if (BIT_TEST(flags, REQ_CACHABLE)) {
-       BIT_SET(e->flag, ENTRY_CACHABLE);
-       BIT_CLR(e->flag, RELEASE_REQUEST);
+    if (EBIT_TEST(flags, REQ_CACHABLE)) {
+       EBIT_SET(e->flag, ENTRY_CACHABLE);
+       EBIT_CLR(e->flag, RELEASE_REQUEST);
     } else {
-       BIT_CLR(e->flag, ENTRY_CACHABLE);
+       EBIT_CLR(e->flag, ENTRY_CACHABLE);
        storeReleaseRequest(e);
     }
-    if (BIT_TEST(flags, REQ_HIERARCHICAL))
-       BIT_SET(e->flag, HIERARCHICAL);
+    if (EBIT_TEST(flags, REQ_HIERARCHICAL))
+       EBIT_SET(e->flag, HIERARCHICAL);
     else
-       BIT_CLR(e->flag, HIERARCHICAL);
+       EBIT_CLR(e->flag, HIERARCHICAL);
     e->store_status = STORE_PENDING;
     storeSetMemStatus(e, NOT_IN_MEMORY);
     e->swap_status = SWAPOUT_NONE;
@@ -589,7 +589,7 @@ storeCreateEntry(const char *url, const char *log_url, int flags, method_t metho
     e->lastref = squid_curtime;
     e->timestamp = 0;          /* set in storeTimestampsSet() */
     e->ping_status = PING_NONE;
-    BIT_SET(e->flag, ENTRY_VALIDATED);
+    EBIT_SET(e->flag, ENTRY_VALIDATED);
     return e;
 }
 
@@ -627,18 +627,18 @@ storeAddDiskRestore(const cache_key * key,
     e->lastmod = lastmod;
     e->refcount = refcount;
     e->flag = flags;
-    BIT_SET(e->flag, ENTRY_CACHABLE);
-    BIT_CLR(e->flag, RELEASE_REQUEST);
-    BIT_CLR(e->flag, KEY_PRIVATE);
+    EBIT_SET(e->flag, ENTRY_CACHABLE);
+    EBIT_CLR(e->flag, RELEASE_REQUEST);
+    EBIT_CLR(e->flag, KEY_PRIVATE);
     e->ping_status = PING_NONE;
     if (clean) {
-       BIT_SET(e->flag, ENTRY_VALIDATED);
+       EBIT_SET(e->flag, ENTRY_VALIDATED);
        /* Only set the file bit if we know its a valid entry */
        /* otherwise, set it in the validation procedure */
        storeDirMapBitSet(file_number);
        storeDirUpdateSwapSize(e->swap_file_number, size, 1);
     } else {
-       BIT_CLR(e->flag, ENTRY_VALIDATED);
+       EBIT_CLR(e->flag, ENTRY_VALIDATED);
     }
     return e;
 }
@@ -841,7 +841,7 @@ storeCheckSwapOut(StoreEntry * e)
     debug(20, 3) ("storeCheckSwapOut: store_status = %s\n",
        storeStatusStr[e->store_status]);
     if (e->store_status == STORE_ABORTED) {
-       assert(BIT_TEST(e->flag, RELEASE_REQUEST));
+       assert(EBIT_TEST(e->flag, RELEASE_REQUEST));
        storeSwapOutFileClose(e);
        return;
     }
@@ -861,7 +861,7 @@ storeCheckSwapOut(StoreEntry * e)
     assert(lowest_offset >= mem->inmem_lo);
 
     new_mem_lo = lowest_offset;
-    if (!BIT_TEST(e->flag, ENTRY_CACHABLE)) {
+    if (!EBIT_TEST(e->flag, ENTRY_CACHABLE)) {
        memFreeDataUpto(mem->data, new_mem_lo);
        mem->inmem_lo = new_mem_lo;
        return;
@@ -935,7 +935,7 @@ storeAppend(StoreEntry * e, const char *buf, int len)
        memAppend(mem->data, buf, len);
        mem->inmem_hi += len;
     }
-    if (e->store_status != STORE_ABORTED && !BIT_TEST(e->flag, DELAY_SENDING))
+    if (e->store_status != STORE_ABORTED && !EBIT_TEST(e->flag, DELAY_SENDING))
        InvokeHandlers(e);
     storeCheckSwapOut(e);
 }
@@ -972,7 +972,7 @@ storeSwapInStart(StoreEntry * e, SIH * callback, void *callback_data)
 {
     swapin_ctrl_t *ctrlp;
     assert(e->mem_status == NOT_IN_MEMORY);
-    if (!BIT_TEST(e->flag, ENTRY_VALIDATED)) {
+    if (!EBIT_TEST(e->flag, ENTRY_VALIDATED)) {
        if (storeDirMapBitTest(e->swap_file_number)) {
            /* someone took our file while we weren't looking */
            callback(-1, callback_data);
@@ -986,7 +986,7 @@ storeSwapInStart(StoreEntry * e, SIH * callback, void *callback_data)
     ctrlp->e = e;
     ctrlp->callback = callback;
     ctrlp->callback_data = callback_data;
-    if (BIT_TEST(e->flag, ENTRY_VALIDATED))
+    if (EBIT_TEST(e->flag, ENTRY_VALIDATED))
        storeSwapInValidateComplete(ctrlp);
     else
        storeValidate(e, storeSwapInValidateComplete, ctrlp);
@@ -1000,7 +1000,7 @@ storeSwapInValidateComplete(void *data)
     StoreEntry *e;
     e = ctrlp->e;
     assert(e->mem_status == NOT_IN_MEMORY);
-    if (!BIT_TEST(e->flag, ENTRY_VALIDATED)) {
+    if (!EBIT_TEST(e->flag, ENTRY_VALIDATED)) {
        /* Invoke a store abort that should free the memory object */
        (ctrlp->callback) (-1, ctrlp->callback_data);
        xfree(ctrlp);
@@ -1121,7 +1121,7 @@ storeDoRebuildFromDisk(void *data)
            RB->invalid++;
            continue;
        }
-       if (BIT_TEST(scan7, KEY_PRIVATE)) {
+       if (EBIT_TEST(scan7, KEY_PRIVATE)) {
            RB->badflags++;
            continue;
        }
@@ -1223,9 +1223,9 @@ storeCleanup(void *datanotused)
        link_ptr = hash_get_bucket(store_table, bucketnum);
        for (; link_ptr; link_ptr = link_ptr->next) {
            e = (StoreEntry *) link_ptr;
-           if (BIT_TEST(e->flag, ENTRY_VALIDATED))
+           if (EBIT_TEST(e->flag, ENTRY_VALIDATED))
                continue;
-           if (BIT_TEST(e->flag, RELEASE_REQUEST))
+           if (EBIT_TEST(e->flag, RELEASE_REQUEST))
                continue;
            curr = xcalloc(1, sizeof(storeCleanList));
            curr->key = storeKeyDup(e->key);
@@ -1240,7 +1240,7 @@ storeCleanup(void *datanotused)
     curr = list;
     list = list->next;
     e = (StoreEntry *) hash_lookup(store_table, curr->key);
-    if (e && !BIT_TEST(e->flag, ENTRY_VALIDATED)) {
+    if (e && !EBIT_TEST(e->flag, ENTRY_VALIDATED)) {
        storeLockObject(e);
        storeValidate(e, storeCleanupComplete, e);
        if ((++validnum & 0xFFF) == 0)
@@ -1257,7 +1257,7 @@ storeCleanupComplete(void *data)
 {
     StoreEntry *e = data;
     storeUnlockObject(e);
-    if (!BIT_TEST(e->flag, ENTRY_VALIDATED))
+    if (!EBIT_TEST(e->flag, ENTRY_VALIDATED))
        storeRelease(e);
 }
 
@@ -1270,9 +1270,9 @@ storeValidate(StoreEntry * e, VCB callback, void *callback_data)
 #if !USE_ASYNC_IO
     int x;
 #endif
-    assert(!BIT_TEST(e->flag, ENTRY_VALIDATED));
+    assert(!EBIT_TEST(e->flag, ENTRY_VALIDATED));
     if (e->swap_file_number < 0) {
-       BIT_CLR(e->flag, ENTRY_VALIDATED);
+       EBIT_CLR(e->flag, ENTRY_VALIDATED);
        callback(callback_data);
        return;
     }
@@ -1307,9 +1307,9 @@ storeValidateComplete(void *data, int retcode, int errcode)
        retcode = stat(path, sb);
     }
     if (retcode < 0 || sb->st_size == 0 || sb->st_size != e->object_len) {
-       BIT_CLR(e->flag, ENTRY_VALIDATED);
+       EBIT_CLR(e->flag, ENTRY_VALIDATED);
     } else {
-       BIT_SET(e->flag, ENTRY_VALIDATED);
+       EBIT_SET(e->flag, ENTRY_VALIDATED);
        storeDirMapBitSet(e->swap_file_number);
        storeDirUpdateSwapSize(e->swap_file_number, e->object_len, 1);
     }
@@ -1388,24 +1388,24 @@ storeCheckCachable(StoreEntry * e)
 {
     if (e->method != METHOD_GET) {
        debug(20, 2) ("storeCheckCachable: NO: non-GET method\n");
-    } else if (!BIT_TEST(e->flag, ENTRY_CACHABLE)) {
+    } else if (!EBIT_TEST(e->flag, ENTRY_CACHABLE)) {
        debug(20, 2) ("storeCheckCachable: NO: not cachable\n");
-    } else if (BIT_TEST(e->flag, RELEASE_REQUEST)) {
+    } else if (EBIT_TEST(e->flag, RELEASE_REQUEST)) {
        debug(20, 2) ("storeCheckCachable: NO: release requested\n");
     } else if (e->store_status == STORE_OK && !storeEntryValidLength(e)) {
        debug(20, 2) ("storeCheckCachable: NO: wrong content-length\n");
-    } else if (BIT_TEST(e->flag, ENTRY_NEGCACHED)) {
+    } else if (EBIT_TEST(e->flag, ENTRY_NEGCACHED)) {
        debug(20, 2) ("storeCheckCachable: NO: negative cached\n");
        return 0;               /* avoid release call below */
     } else if (e->mem_obj->inmem_hi > Config.Store.maxObjectSize) {
        debug(20, 2) ("storeCheckCachable: NO: too big\n");
-    } else if (BIT_TEST(e->flag, KEY_PRIVATE)) {
+    } else if (EBIT_TEST(e->flag, KEY_PRIVATE)) {
        debug(20, 3) ("storeCheckCachable: NO: private key\n");
     } else {
        return 1;
     }
     storeReleaseRequest(e);
-    BIT_CLR(e->flag, ENTRY_CACHABLE);
+    EBIT_CLR(e->flag, ENTRY_CACHABLE);
     return 0;
 }
 
@@ -1597,11 +1597,11 @@ storeRelease(StoreEntry * e)
            storeUrl(e));
        storeExpireNow(e);
        storeSetPrivateKey(e);
-       BIT_SET(e->flag, RELEASE_REQUEST);
+       EBIT_SET(e->flag, RELEASE_REQUEST);
        return 0;
     }
     if (e->swap_file_number > -1) {
-       if (BIT_TEST(e->flag, ENTRY_VALIDATED))
+       if (EBIT_TEST(e->flag, ENTRY_VALIDATED))
            storePutUnusedFileno(e->swap_file_number);
        storeDirUpdateSwapSize(e->swap_file_number, e->object_len, -1);
        e->swap_file_number = -1;
@@ -1623,7 +1623,7 @@ storeEntryLocked(const StoreEntry * e)
        return 1;
     if (e->store_status == STORE_PENDING)
        return 1;
-    if (BIT_TEST(e->flag, ENTRY_SPECIAL))
+    if (EBIT_TEST(e->flag, ENTRY_SPECIAL))
        return 1;
     return 0;
 }
@@ -1965,9 +1965,9 @@ storeWriteCleanLogs(int reopen)
            continue;
        if (e->object_len <= 0)
            continue;
-       if (BIT_TEST(e->flag, RELEASE_REQUEST))
+       if (EBIT_TEST(e->flag, RELEASE_REQUEST))
            continue;
-       if (BIT_TEST(e->flag, KEY_PRIVATE))
+       if (EBIT_TEST(e->flag, KEY_PRIVATE))
            continue;
        dirn = storeDirNumber(e->swap_file_number);
        assert(dirn < Config.cacheSwap.n_configured);
@@ -2108,7 +2108,7 @@ storeCheckExpired(const StoreEntry * e, int check_lru_age)
 {
     if (storeEntryLocked(e))
        return 0;
-    if (BIT_TEST(e->flag, ENTRY_NEGCACHED) && squid_curtime >= e->expires)
+    if (EBIT_TEST(e->flag, ENTRY_NEGCACHED) && squid_curtime >= e->expires)
        return 1;
     if (!check_lru_age)
        return 0;
@@ -2156,7 +2156,7 @@ void
 storeNegativeCache(StoreEntry * e)
 {
     e->expires = squid_curtime + Config.negativeTtl;
-    BIT_SET(e->flag, ENTRY_NEGCACHED);
+    EBIT_SET(e->flag, ENTRY_NEGCACHED);
 }
 
 void
@@ -2191,9 +2191,9 @@ expiresMoreThan(time_t expires, time_t when)
 int
 storeEntryValidToSend(StoreEntry * e)
 {
-    if (BIT_TEST(e->flag, RELEASE_REQUEST))
+    if (EBIT_TEST(e->flag, RELEASE_REQUEST))
        return 0;
-    if (BIT_TEST(e->flag, ENTRY_NEGCACHED))
+    if (EBIT_TEST(e->flag, ENTRY_NEGCACHED))
        if (e->expires <= squid_curtime)
            return 0;
     if (e->store_status == STORE_ABORTED)
index 604d1898ec8796b40c80a33f25148e86e81ea0d8..c48a1feb60d3207aa469ce08d37536be289f7c0f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir.cc,v 1.36 1997/11/03 22:43:22 wessels Exp $
+ * $Id: store_dir.cc,v 1.37 1997/11/12 00:09:10 wessels Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -215,7 +215,7 @@ storeDirSwapLog(const StoreEntry * e)
     assert(e->swap_file_number >= 0);
     dirn = e->swap_file_number >> SWAP_DIR_SHIFT;
     assert(dirn < Config.cacheSwap.n_configured);
-    assert(!BIT_TEST(e->flag, KEY_PRIVATE));
+    assert(!EBIT_TEST(e->flag, KEY_PRIVATE));
     /* Note this printf format appears in storeWriteCleanLog() too */
     snprintf(logmsg, MAX_URL << 1, "%08x %08x %08x %08x %08x %9d %6d %08x %s\n",
        (int) e->swap_file_number,
index 4a78c882f07c63f7bc45935c242b99558e01e0f5..624b7e86d8a280bea4850c3045fdc8a6d374fb38 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tunnel.cc,v 1.69 1997/11/05 05:29:36 wessels Exp $
+ * $Id: tunnel.cc,v 1.70 1997/11/12 00:09:05 wessels Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -306,7 +306,7 @@ sslConnected(int fd, void *data)
 }
 
 static void
-sslErrorComplete(int fdnotused, void *sslState, int sizenotused)
+sslErrorComplete(int fdnotused, void *sslState, size_t sizenotused)
 {
     assert(sslState != NULL);
     sslClose(sslState);
index 3260642cba801cf656e371878a57e2c9400707a7..06f6d038fcac11159f807cd520591efcb0b49977 100644 (file)
@@ -75,7 +75,7 @@ typedef struct _dlink_node dlink_node;
 typedef struct _dlink_list dlink_list;
 
 typedef void AIOCB(void *, int aio_return, int aio_errno);
-typedef void CWCB(int fd, char *, int size, int errflag, void *data);
+typedef void CWCB(int fd, char *, size_t size, int flag, void *data);
 typedef void CNCB(int fd, int status, void *);
 typedef void FREE(void *);
 typedef void FOCB(void *, int fd);
@@ -97,7 +97,7 @@ typedef void SIH(int fd, void *);     /* swap in */
 typedef int QS(const void *, const void *);    /* qsort */
 typedef void STCB(void *, char *, ssize_t);    /* store callback */
 typedef void STABH(void *);
-typedef void ERCB(int fd, void *, int size);
+typedef void ERCB(int fd, void *, size_t);
 typedef void OBJH(StoreEntry *);
 typedef void SIGHDLR(int sig);
 
index 1d52a2b1f93437047ee72c78b29b437b5028eb0a..e3f55ef3a13da29838da97959485a6a209d6d366 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.96 1997/11/05 05:29:41 wessels Exp $
+ * $Id: wais.cc,v 1.97 1997/11/12 00:09:13 wessels Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -193,7 +193,7 @@ waisReadReply(int fd, void *data)
                waisReadReply, waisState, 0);
        } else {
            ErrorState *err;
-           BIT_CLR(entry->flag, ENTRY_CACHABLE);
+           EBIT_CLR(entry->flag, ENTRY_CACHABLE);
            storeReleaseRequest(entry);
            err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR);
            err->xerrno = errno;
@@ -227,7 +227,7 @@ waisReadReply(int fd, void *data)
 /* This will be called when request write is complete. Schedule read of
  * reply. */
 static void
-waisSendComplete(int fd, char *bufnotused, int size, int errflag, void *data)
+waisSendComplete(int fd, char *bufnotused, size_t size, int errflag, void *data)
 {
     WaisStateData *waisState = data;
     StoreEntry *entry = waisState->entry;
@@ -276,7 +276,7 @@ waisSendRequest(int fd, void *data)
        snprintf(buf, len + 1, "%s %s\r\n", Method, waisState->request);
     debug(24, 6) ("waisSendRequest: buf: %s\n", buf);
     comm_write(fd, buf, len, waisSendComplete, waisState, xfree);
-    if (BIT_TEST(waisState->entry->flag, ENTRY_CACHABLE))
+    if (EBIT_TEST(waisState->entry->flag, ENTRY_CACHABLE))
        storeSetPublicKey(waisState->entry);    /* Make it public */
 }