You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2004/07/28 19:29:00 UTC
cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_link.c ajp.h
mturk 2004/07/28 10:29:00
Modified: ajp/ajplib/test ajp_link.c ajp.h
Log:
Add more error codes.
Make ajp_msg_t::buf to be apr_byte_t
ajp_ilink_readN -> ilink_read (since it's static no ajp_ prefix)
Revision Changes Path
1.5 +11 -10 jakarta-tomcat-connectors/ajp/ajplib/test/ajp_link.c
Index: ajp_link.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_link.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ajp_link.c 28 Jul 2004 16:12:15 -0000 1.4
+++ ajp_link.c 28 Jul 2004 17:29:00 -0000 1.5
@@ -25,7 +25,7 @@
if (sock == NULL) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, NULL,
"ajp_ilink_send(): NULL socket provided");
- return -1;
+ return AJP_EINVAL;
}
ajp_msg_end(msg);
@@ -40,7 +40,7 @@
if (status != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, NULL,
"ajp_ilink_send(): send failed");
- return -3; /* -2 is not possible... */
+ return status;
}
length -= written;
buf += written;
@@ -50,7 +50,8 @@
}
-static apr_status_t ajp_ilink_readN(apr_socket_t *sock, char * buf, const apr_size_t len)
+static apr_status_t ilink_read(apr_socket_t *sock, char * buf,
+ apr_size_t len)
{
apr_size_t length;
apr_status_t status;
@@ -59,7 +60,7 @@
if (sock == NULL) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, NULL,
"ajp_ilink_readN(): NULL socket provided");
- return -1;
+ return AJP_EINVAL;
}
rdlen = 0;
@@ -92,17 +93,17 @@
if (sock == NULL) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, NULL,
"ajp_ilink_receive(): NULL socket provided");
- return -1;
+ return AJP_EINVAL;
}
hlen = msg->headerLen;
- status = ajp_ilink_readN(sock, msg->buf, hlen);
+ status = ilink_read(sock, msg->buf, hlen);
if (status != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, NULL,
"ajp_ilink_receive() can't receive header\n");
- return -1;
+ return AJP_ENO_HEADER;
}
status = ajp_msg_check_header(msg, &blen);
@@ -110,16 +111,16 @@
if (status != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, NULL,
"ajp_ilink_receive() received bad header\n");
- return -2;
+ return AJP_EBAD_HEADER;
}
- status = ajp_ilink_readN(sock, msg->buf + hlen, blen);
+ status = ilink_read(sock, msg->buf + hlen, blen);
if (status != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, NULL,
"ajp_ilink_receive() error while receiving message body %of length %d\n",
hlen);
- return -3;
+ return AJP_EBAD_MESSAGE;
}
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, NULL,
1.9 +21 -15 jakarta-tomcat-connectors/ajp/ajplib/test/ajp.h
Index: ajp.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ajp.h 28 Jul 2004 16:57:25 -0000 1.8
+++ ajp.h 28 Jul 2004 17:29:00 -0000 1.9
@@ -68,43 +68,49 @@
/** AJP Specific error codes
*/
-
-/** @see APR_STATUS_IS_ENOSTAT */
-/* Buffer overflow exception */
+/** Buffer overflow exception */
#define AJP_EOVERFLOW (APR_OS_START_USERERR + 1)
-/* Destination Buffer is to small */
+/** Destination Buffer is to small */
#define AJP_ETOSMALL (APR_OS_START_USERERR + 2)
-/* Invalid input parameters */
+/** Invalid input parameters */
#define AJP_EINVAL (APR_OS_START_USERERR + 3)
-/* Bad message signature */
+/** Bad message signature */
#define AJP_EBAD_SIGNATURE (APR_OS_START_USERERR + 4)
-/* Incoming message too bg */
+/** Incoming message too bg */
#define AJP_ETOBIG (APR_OS_START_USERERR + 5)
+/** Missing message header */
+#define AJP_ENO_HEADER (APR_OS_START_USERERR + 6)
+/** Bad message header */
+#define AJP_EBAD_HEADER (APR_OS_START_USERERR + 7)
+/** Bad message */
+#define AJP_EBAD_MESSAGE (APR_OS_START_USERERR + 8)
+
+/** A structure that represents ajp message */
+typedef struct ajp_msg ajp_msg_t;
+/** A structure that represents ajp message */
struct ajp_msg
{
- char * buf;
+ apr_byte_t *buf;
apr_size_t headerLen;
apr_size_t len;
apr_size_t pos;
- int serverSide;
+ int serverSide;
};
-typedef struct ajp_msg ajp_msg_t;
-
#define AJP_HEADER_LEN 4
#define AJP_HEADER_SZ_LEN 2
-#define AJP_MSG_BUFFER_SZ (8*1024)
+#define AJP_MSG_BUFFER_SZ (8*1024)
#define AJP13_MAX_SEND_BODY_SZ (AJP_DEF_BUFFER_SZ - 6)
/* Webserver ask container to take control (logon phase) */
-#define CMD_AJP13_PING (unsigned char)8
+#define CMD_AJP13_PING (unsigned char)8
/* Webserver check if container is alive, since container should respond by cpong */
-#define CMD_AJP13_CPING (unsigned char)10
+#define CMD_AJP13_CPING (unsigned char)10
/* Container response to cping request */
-#define CMD_AJP13_CPONG (unsigned char)9
+#define CMD_AJP13_CPONG (unsigned char)9
/**
* Check a new AJP Message by looking at signature and return its size
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org