You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by hg...@apache.org on 2001/06/01 12:01:11 UTC
cvs commit: jakarta-tomcat-connectors/jk/src/native/common jk_msg_buff.c jk_msg_buff.h
hgomez 01/06/01 03:01:11
Modified: jk/src/native/common jk_msg_buff.c jk_msg_buff.h
Log:
Updated functions to handle bytes (jk_b_get_bytes)
Revision Changes Path
1.3 +17 -1 jakarta-tomcat-connectors/jk/src/native/common/jk_msg_buff.c
Index: jk_msg_buff.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/src/native/common/jk_msg_buff.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_msg_buff.c 2001/05/15 10:14:18 1.2
+++ jk_msg_buff.c 2001/06/01 10:01:08 1.3
@@ -58,7 +58,7 @@
* Author: Costin <co...@costin.dnt.ro> *
* Author: Gal Shachor <sh...@il.ibm.com> *
* Author: Henri Gomez <hg...@slib.fr> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#include "jk_pool.h"
@@ -397,6 +397,22 @@
return (unsigned char *)(msg->buf + start);
}
+
+int jk_b_get_bytes(jk_msg_buf_t *msg, unsigned char * buf, int len)
+{
+ int start = msg->pos;
+
+ if((len < 0 ) || (len + start > msg->maxlen)) {
+ jk_b_dump(msg, "After get bytes");
+ printf("ERROR\n" );
+ return (-1);
+ }
+
+ memcpy(buf, msg->buf + start, len);
+ msg->pos += len;
+ return (len);
+}
+
/** Shame-less copy from somewhere.
assert (src != dst)
1.3 +10 -1 jakarta-tomcat-connectors/jk/src/native/common/jk_msg_buff.h
Index: jk_msg_buff.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/src/native/common/jk_msg_buff.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_msg_buff.h 2001/05/15 10:14:16 1.2
+++ jk_msg_buff.h 2001/06/01 10:01:09 1.3
@@ -57,7 +57,7 @@
* Description: Data marshaling. XDR like *
* Author: Costin <co...@costin.dnt.ro> *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#ifndef JK_MSG_BUF_H
@@ -168,6 +168,9 @@
int jk_b_append_string(jk_msg_buf_t *msg,
const char *param);
+int jk_b_append_bytes(jk_msg_buf_t *msg,
+ const unsigned char *param,
+ int len);
/* -------------------- Decoding -------------------- */
@@ -186,6 +189,12 @@
/** Get a String from the current position
*/
unsigned char *jk_b_get_string(jk_msg_buf_t *msg);
+
+/** Get Bytes from the current position
+ */
+int jk_b_get_bytes(jk_msg_buf_t *msg,
+ unsigned char * buf,
+ int len);
/** Get a byte from an arbitrary position
*/