/*
- * $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
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
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);
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;
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;
}
static void
-commConnectCallback(ConnectStateData * cs, int status)
+commConnectCallback(ConnectStateData * cs, comm_err_t status)
{
CNCB *callback = cs->callback;
void *cbdata = cs->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;
/*
- * $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
*
* events.
*/
-int
+comm_err_t
comm_select(int msec)
{
int num, i;
/*
- * $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
*
}
/* poll all sockets; call handlers for those that are ready. */
-int
+comm_err_t
comm_select(int msec)
{
struct pollfd pfds[SQUID_MAXFD];
/*
- * $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
*
#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;
/*
- * $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)
/*
- * $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/
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_)
/*
/*
- * $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
* 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);
/*
- * $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
}
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;
/*
- * $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
}
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);
/*
- * $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
/* 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;
}
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;
/*
- * $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
}
static void
-identConnectDone(int fd, int status, void *data)
+identConnectDone(int fd, comm_err_t status, void *data)
{
IdentStateData *state = data;
IdentClient *c;
/*
- * $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
}
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) {
/*
- * $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/
* 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);
/*
- * $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
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;
/*
- * $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
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;
/*
- * $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/
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 *);
/*
- * $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
/* 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;