]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Tidy up the COMM_OK and COMM_ERR_* magical #define constants into
authoradrian <>
Sun, 15 Sep 2002 12:23:28 +0000 (12:23 +0000)
committeradrian <>
Sun, 15 Sep 2002 12:23:28 +0000 (12:23 +0000)
an enum, and modify the relevant callback routines to take a comm_err_t
as an argument rather than an int.

This is prefixed w/ a PRE_COMMLOOPS_20020915 tag.

17 files changed:
src/comm.cc
src/comm_kqueue.cc
src/comm_poll.cc
src/comm_select.cc
src/defines.h
src/enums.h
src/errorpage.cc
src/forward.cc
src/ftp.cc
src/http.cc
src/ident.cc
src/neighbors.cc
src/protos.h
src/ssl.cc
src/tunnel.cc
src/typedefs.h
src/wais.cc

index 72175de36328862559d328db1ce44de9752aeaad..88d725c05f9640ecb8b83d6c67f49a98886e2ef6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.332 2002/09/12 09:43:51 adrian Exp $
+ * $Id: comm.cc,v 1.333 2002/09/15 06:23:28 adrian Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -60,7 +60,7 @@ typedef struct {
 static int commBind(int s, struct in_addr, u_short port);
 static void commSetReuseAddr(int);
 static void commSetNoLinger(int);
-static void CommWriteStateCallbackAndFree(int fd, int code);
+static void CommWriteStateCallbackAndFree(int fd, comm_err_t code);
 #ifdef TCP_NODELAY
 static void commSetTcpNoDelay(int);
 #endif
@@ -69,7 +69,7 @@ static PF commConnectFree;
 static PF commConnectHandle;
 static PF commHandleWrite;
 static IPH commConnectDnsHandle;
-static void commConnectCallback(ConnectStateData * cs, int status);
+static void commConnectCallback(ConnectStateData * cs, comm_err_t status);
 static int commResetFD(ConnectStateData * cs);
 static int commRetryConnect(ConnectStateData * cs);
 CBDATA_TYPE(ConnectStateData);
@@ -78,7 +78,7 @@ static MemPool *comm_write_pool = NULL;
 static MemPool *conn_close_pool = NULL;
 
 static void
-CommWriteStateCallbackAndFree(int fd, int code)
+CommWriteStateCallbackAndFree(int fd, comm_err_t code)
 {
     CommWriteStateData *CommWriteState = fd_table[fd].rwstate;
     CWCB *callback = NULL;
@@ -125,7 +125,7 @@ comm_local_port(int fd)
     return F->local_port;
 }
 
-static int
+static comm_err_t
 commBind(int s, struct in_addr in_addr, u_short port)
 {
     struct sockaddr_in S;
@@ -298,7 +298,7 @@ commConnectDnsHandle(const ipcache_addrs * ia, void *data)
 }
 
 static void
-commConnectCallback(ConnectStateData * cs, int status)
+commConnectCallback(ConnectStateData * cs, comm_err_t status)
 {
     CNCB *callback = cs->callback;
     void *cbdata = cs->data;
@@ -457,7 +457,7 @@ commSetTimeout(int fd, int timeout, PF * handler, void *data)
 int
 comm_connect_addr(int sock, const struct sockaddr_in *address)
 {
-    int status = COMM_OK;
+    comm_err_t status = COMM_OK;
     fde *F = &fd_table[sock];
     int x;
     int err = 0;
index f37fb1348a1bc2f76a44fde7159c3bbe36a21cd0..49a5268637aaba00b2796537c0bd57e6bbce2359 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_kqueue.cc,v 1.1 2002/01/01 09:47:48 adrian Exp $
+ * $Id: comm_kqueue.cc,v 1.2 2002/09/15 06:23:28 adrian Exp $
  *
  * DEBUG: section 5    Socket functions
  *
@@ -217,7 +217,7 @@ commSetSelect(int fd, unsigned int type, PF * handler,
  * events.
  */
 
-int
+comm_err_t
 comm_select(int msec)
 {
     int num, i;
index fe199a0c1aa7f18ed985e7959123e23bf6d63d74..866a73ef9ccde4b395c6a64a6c043c1631c1853a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_poll.cc,v 1.3 2002/07/28 21:55:33 hno Exp $
+ * $Id: comm_poll.cc,v 1.4 2002/09/15 06:23:28 adrian Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -307,7 +307,7 @@ comm_poll_http_incoming(void)
 }
 
 /* poll all sockets; call handlers for those that are ready. */
-int
+comm_err_t
 comm_select(int msec)
 {
     struct pollfd pfds[SQUID_MAXFD];
index 800c54031531111d022b6ae8245a3eec23aa9250..7fef8efbe6baec33335e41fbcbb5971d3b110e18 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_select.cc,v 1.57 2002/07/28 21:55:33 hno Exp $
+ * $Id: comm_select.cc,v 1.58 2002/09/15 06:23:28 adrian Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -314,7 +314,7 @@ comm_select_http_incoming(void)
 
 #define DEBUG_FDBITS 0
 /* Select on all sockets; call handlers for those that are ready. */
-int
+comm_err_t
 comm_select(int msec)
 {
     fd_set readfds;
index b65530c5fcf1266277a413c3b3e947453ebc945b..ee5ae94880ed0215e8547da861e44d2b2f2e52d9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: defines.h,v 1.107 2002/08/08 20:12:45 hno Exp $
+ * $Id: defines.h,v 1.108 2002/09/15 06:23:29 adrian Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
 
 #define MAXHTTPPORTS                   128
 
-#define COMM_OK                  (0)
-#define COMM_ERROR      (-1)
-#define COMM_NOMESSAGE  (-3)
-#define COMM_TIMEOUT    (-4)
-#define COMM_SHUTDOWN   (-5)
-#define COMM_INPROGRESS  (-6)
-#define COMM_ERR_CONNECT (-7)
-#define COMM_ERR_DNS     (-8)
-#define COMM_ERR_CLOSING (-9)
-
 /* Select types. */
 #define COMM_SELECT_READ   (0x1)
 #define COMM_SELECT_WRITE  (0x2)
index a2976a95c28250aa808e593753f3d70a99690257..026d90695ca7d737ccc1d69cce1b06fb0d6750ba 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.212 2002/09/15 05:41:57 robertc Exp $
+ * $Id: enums.h,v 1.213 2002/09/15 06:23:29 adrian Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -752,6 +752,19 @@ typedef enum {
     DIGEST_READ_DONE
 } digest_read_state_t;
 
+typedef enum {
+    COMM_OK            = 0,
+    COMM_ERROR         = -1,
+    COMM_NOMESSAGE     = -3,
+    COMM_TIMEOUT       = -4,
+    COMM_SHUTDOWN      = -5,
+    COMM_INPROGRESS    = -6,
+    COMM_ERR_CONNECT   = -7,
+    COMM_ERR_DNS       = -8,
+    COMM_ERR_CLOSING   = -9
+} comm_err_t;
+
+
 /* CygWin & Windows NT Port */
 #if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
 /*
index d4ad5032d1206f88e6c683077e11b6b45b4d703f..bda2c501a7dcdf684da06687aebd7fa7e6f22adc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.cc,v 1.175 2002/09/10 09:54:53 hno Exp $
+ * $Id: errorpage.cc,v 1.176 2002/09/15 06:23:28 adrian Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
@@ -376,7 +376,7 @@ errorSend(int fd, ErrorState * err)
  *            closeing the FD, otherwise we do it ourseves.
  */
 static void
-errorSendComplete(int fd, char *bufnotused, size_t size, int errflag, void *data)
+errorSendComplete(int fd, char *bufnotused, size_t size, comm_err_t errflag, void *data)
 {
     ErrorState *err = data;
     debug(4, 3) ("errorSendComplete: FD %d, size=%ld\n", fd, (long int) size);
index 2dfff334c396336f9d391001d652fd71b5c5553a..5e1698bcb57709768aef0882bef11ebd01d0bf6f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: forward.cc,v 1.85 2002/06/21 12:58:20 hno Exp $
+ * $Id: forward.cc,v 1.86 2002/09/15 06:23:29 adrian Exp $
  *
  * DEBUG: section 17    Request Forwarding
  * AUTHOR: Duane Wessels
@@ -177,7 +177,7 @@ fwdServerClosed(int fd, void *data)
 }
 
 static void
-fwdConnectDone(int server_fd, int status, void *data)
+fwdConnectDone(int server_fd, comm_err_t status, void *data)
 {
     FwdState *fwdState = data;
     static FwdState *current = NULL;
index 8ba1037628a2c6fc3d57166db9553cec378f3f50..99f6fb9841b67ea1ae51aaab42af86b59895b483 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.327 2002/09/05 18:07:45 hno Exp $
+ * $Id: ftp.cc,v 1.328 2002/09/15 06:23:29 adrian Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -1128,7 +1128,7 @@ ftpWriteCommand(const char *buf, FtpStateData * ftpState)
 }
 
 static void
-ftpWriteCommandCallback(int fd, char *bufnotused, size_t size, int errflag, void *data)
+ftpWriteCommandCallback(int fd, char *bufnotused, size_t size, comm_err_t errflag, void *data)
 {
     FtpStateData *ftpState = data;
     debug(9, 7) ("ftpWriteCommandCallback: wrote %d bytes\n", (int) size);
index 385c4f88d1836f79f4a71b2079d020c8ec73a3c7..6a7765ca89195ac0bf76cf317e20ecdab71b0ca4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.390 2002/09/07 22:51:41 hno Exp $
+ * $Id: http.cc,v 1.391 2002/09/15 06:23:29 adrian Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -671,7 +671,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, size_t size, int errflag, void *data)
+httpSendComplete(int fd, char *bufnotused, size_t size, comm_err_t errflag, void *data)
 {
     HttpStateData *httpState = data;
     StoreEntry *entry = httpState->entry;
@@ -1072,7 +1072,7 @@ httpRequestBodyHandler(char *buf, size_t size, void *data)
 }
 
 static void
-httpSendRequestEntity(int fd, char *bufnotused, size_t size, int errflag, void *data)
+httpSendRequestEntity(int fd, char *bufnotused, size_t size, comm_err_t errflag, void *data)
 {
     HttpStateData *httpState = data;
     StoreEntry *entry = httpState->entry;
index d349bf138499672056d207de82ba1016cf7d30e2..9a46973f87e28a906eb57d7915593e7a259b863f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ident.cc,v 1.59 2002/04/13 23:07:50 hno Exp $
+ * $Id: ident.cc,v 1.60 2002/09/15 06:23:29 adrian Exp $
  *
  * DEBUG: section 30    Ident (RFC 931)
  * AUTHOR: Duane Wessels
@@ -98,7 +98,7 @@ identTimeout(int fd, void *data)
 }
 
 static void
-identConnectDone(int fd, int status, void *data)
+identConnectDone(int fd, comm_err_t status, void *data)
 {
     IdentStateData *state = data;
     IdentClient *c;
index b6a70462d0d01a3fe340db44c12e625b55e151c7..7ef317514eb275fd17851b4a9f651edcd06f40e4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.304 2002/08/28 04:40:04 wessels Exp $
+ * $Id: neighbors.cc,v 1.305 2002/09/15 06:23:29 adrian Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -1138,7 +1138,7 @@ peerProbeConnect2(const ipcache_addrs * ianotused, void *data)
 }
 
 static void
-peerProbeConnectDone(int fd, int status, void *data)
+peerProbeConnectDone(int fd, comm_err_t status, void *data)
 {
     peer *p = data;
     if (status == COMM_OK) {
index 95c2ebf0ff79107491d78c71f4e01a2c023bf7d0..3a46de272d27e8587f97d365f4fde78a5340c5ca 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.445 2002/09/15 05:41:57 robertc Exp $
+ * $Id: protos.h,v 1.446 2002/09/15 06:23:29 adrian Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -203,7 +203,7 @@ extern int commDeferRead(int fd);
  * comm_select.c
  */
 extern void comm_select_init(void);
-extern int comm_select(int);
+extern comm_err_t comm_select(int);
 extern void comm_quick_poll_required(void);
 
 extern void packerToStoreInit(Packer * p, StoreEntry * e);
index 5bd20889d9f95e674535a1eda16ec7715b0a8b71..12a73e86215f8522aad2a8b60d1aab96242fefdd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ssl.cc,v 1.120 2002/07/20 12:30:04 hno Exp $
+ * $Id: ssl.cc,v 1.121 2002/09/15 06:23:29 adrian Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -381,7 +381,7 @@ sslErrorComplete(int fdnotused, void *data, size_t sizenotused)
 
 
 static void
-sslConnectDone(int fdnotused, int status, void *data)
+sslConnectDone(int fdnotused, comm_err_t status, void *data)
 {
     SslStateData *sslState = data;
     request_t *request = sslState->request;
index 5774b7ea62624f33c24ec4367730e0c7fa6f8ebb..025f053592857441b1ed61462d7b77df44e0adb8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tunnel.cc,v 1.120 2002/07/20 12:30:04 hno Exp $
+ * $Id: tunnel.cc,v 1.121 2002/09/15 06:23:29 adrian Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -381,7 +381,7 @@ sslErrorComplete(int fdnotused, void *data, size_t sizenotused)
 
 
 static void
-sslConnectDone(int fdnotused, int status, void *data)
+sslConnectDone(int fdnotused, comm_err_t status, void *data)
 {
     SslStateData *sslState = data;
     request_t *request = sslState->request;
index 9b10671960379e43ad09cb6780e30b3f09a3b13c..e635662eed624fa498ddcf4f9f9ede23b499b26f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: typedefs.h,v 1.135 2002/09/15 05:41:57 robertc Exp $
+ * $Id: typedefs.h,v 1.136 2002/09/15 06:23:29 adrian Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -209,8 +209,8 @@ typedef void CSR(clientStreamNode *, clientHttpRequest *);
 typedef void CSD(clientStreamNode *, clientHttpRequest *);
 typedef clientStream_status_t CSS(clientStreamNode *, clientHttpRequest *);
 
-typedef void CWCB(int fd, char *, size_t size, int flag, void *data);
-typedef void CNCB(int fd, int status, void *);
+typedef void CWCB(int fd, char *, size_t size, comm_err_t flag, void *data);
+typedef void CNCB(int fd, comm_err_t status, void *);
 
 typedef void FREE(void *);
 typedef void CBDUNL(void *);
index f75d4bf1aaf12c93fe31a7b4e7f264eba901bbea..c245dfca6f1fc773fa9592c1002b5d6d02f4567a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.138 2001/10/24 08:19:09 hno Exp $
+ * $Id: wais.cc,v 1.139 2002/09/15 06:23:29 adrian Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -162,7 +162,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, size_t size, int errflag, void *data)
+waisSendComplete(int fd, char *bufnotused, size_t size, comm_err_t errflag, void *data)
 {
     WaisStateData *waisState = data;
     StoreEntry *entry = waisState->entry;