CVS update: php31/ext/rpc
| From: | ssb | Date: | Thu, 17 Sep 1998 01:31:42 +0000 |
| Subject: | CVS update: php31/ext/rpc | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1188@lists.php.net to get a copy of this message | ||
Date: Wednesday September 16, 1998 @ 21:31
Author: ssb
Update of /repository/php31/ext/rpc
In directory asf:/u2/tmp/cvs-serv23538
Modified Files:
.cvsignore Makefile.am php3_rpc.h rpc.c
Added Files:
prc.h prcalloc.c prcd.c rpc_protocol.h
Log Message:
Too tired to continue, checking in, passing out.
Index: php31/ext/rpc/.cvsignore
diff -c php31/ext/rpc/.cvsignore:1.1 php31/ext/rpc/.cvsignore:1.2
*** php31/ext/rpc/.cvsignore:1.1 Wed Sep 16 19:11:03 1998
--- php31/ext/rpc/.cvsignore Wed Sep 16 21:31:40 1998
***************
*** 1,3 ****
--- 1,4 ----
.deps
Makefile
Makefile.in
+ prcd
Index: php31/ext/rpc/Makefile.am
diff -c php31/ext/rpc/Makefile.am:1.1 php31/ext/rpc/Makefile.am:1.2
*** php31/ext/rpc/Makefile.am:1.1 Tue Sep 15 19:37:27 1998
--- php31/ext/rpc/Makefile.am Wed Sep 16 21:31:40 1998
***************
*** 1,4 ****
--- 1,8 ----
## Process this file with automake to produce Makefile.in
INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/main
+ LDADD=$(shell echo $$LDADD | sed \-e's!\.\./lib/!../../lib/!g')
noinst_LIBRARIES=libphpext_rpc.a
libphpext_rpc_a_SOURCES=rpc.c
+ noinst_PROGRAMS=prcd
+ prcd_SOURCES=prcd.c prcalloc.c
+ prcd_LDADD=libphpext_rpc.a
Index: php31/ext/rpc/php3_rpc.h
diff -c php31/ext/rpc/php3_rpc.h:1.2 php31/ext/rpc/php3_rpc.h:1.3
*** php31/ext/rpc/php3_rpc.h:1.2 Wed Sep 16 19:11:03 1998
--- php31/ext/rpc/php3_rpc.h Wed Sep 16 21:31:41 1998
***************
*** 27,50 ****
+----------------------------------------------------------------------+
*/
! /* $Id: php3_rpc.h,v 1.2 1998/09/16 23:11:03 ssb Exp $ */
! #define RPC_NOP 0
! /* function calling opcodes */
! #define RPC_FUNCTION_CALL 1
! #define RPC_FUNCTION_NPARAMS 2
! #define RPC_FUNCTION_PARAMETER 3
! #define RPC_RETURN_VALUE 4
!
! /* value passing opcodes */
! #define RPC_TYPE_LONG 10
! #define RPC_TYPE_STRING 11
! #define RPC_TYPE_DOUBLE 12
! #define RPC_TYPE_ARRAY 13
- #define rpc_module_ptr &rpc_module_entry
-
extern php3_module_entry rpc_module_entry;
void php3_serialize(INTERNAL_FUNCTION_PARAMETERS);
--- 27,39 ----
+----------------------------------------------------------------------+
*/
! /* $Id: php3_rpc.h,v 1.3 1998/09/17 01:31:41 ssb Exp $ */
! #ifndef _PHP3_RPC_H
! # define _PHP3_RPC_H
! # define rpc_module_ptr &rpc_module_entry
extern php3_module_entry rpc_module_entry;
void php3_serialize(INTERNAL_FUNCTION_PARAMETERS);
***************
*** 58,63 ****
--- 47,53 ----
int socket;
} rpc_module;
+ #endif /* _PHP3_RPC_H */
/*
* Local variables:
* tab-width: 4
Index: php31/ext/rpc/rpc.c
diff -c php31/ext/rpc/rpc.c:1.2 php31/ext/rpc/rpc.c:1.3
*** php31/ext/rpc/rpc.c:1.2 Wed Sep 16 19:11:04 1998
--- php31/ext/rpc/rpc.c Wed Sep 16 21:31:41 1998
***************
*** 27,33 ****
+----------------------------------------------------------------------+
*/
! /* $Id: rpc.c,v 1.2 1998/09/16 23:11:04 ssb Exp $ */
#ifdef THREAD_SAFE
# include "tls.h"
--- 27,33 ----
+----------------------------------------------------------------------+
*/
! /* $Id: rpc.c,v 1.3 1998/09/17 01:31:41 ssb Exp $ */
#ifdef THREAD_SAFE
# include "tls.h"
***************
*** 49,54 ****
--- 49,55 ----
#endif
#include "php3_rpc.h"
+ #include "rpc_protocol.h"
/* TODO:
*
***************
*** 257,271 ****
}
int
php3i_serialize(pval *val, char **resultp, int *sizep)
{
unsigned short type;
unsigned long size, value;
- type = htons(val->type);
switch (val->type) {
case IS_STRING:
size = htonl((unsigned long)val->value.str.len);
*sizep = sizeof(type) + sizeof(size) + val->value.str.len;
*resultp = emalloc(*sizep);
--- 258,337 ----
}
+ static void
+ rpc_msg_short(char **buffer, /* data buffer */
+ int *pos, /* pointer to current buffer offset */
+ int *size, /* pointer to buffer size */
+ unsigned short value) /* value to append to the buffer */
+ {
+ int len = sizeof(value);
+ char *juks;
+
+ value = htons(value);
+ juks = (char *)&value;
+ rpc_msg_raw(buffer, pos, size, juks, len);
+ }
+
+
+ static void
+ rpc_msg_long(char **buffer, /* data buffer */
+ int *pos, /* pointer to current buffer offset */
+ int *size, /* pointer to buffer size */
+ long value) /* value to append to the buffer */
+ {
+ int len = sizeof(value);
+ char *juks;
+
+ value = htonl(value);
+ juks = (char *)&value;
+ rpc_msg_raw(buffer, pos, size, juks, len);
+ }
+
+
+ static void
+ rpc_msg_pval(char **buffer, /* data buffer */
+ int *pos, /* pointer to current buffer offset */
+ int *size, /* pointer to buffer size */
+ pval *val) /* pval to serialize and append */
+ {
+ int srl_size;
+ char *srl_buf;
+
+ if (php3i_serialize(val, &srl_buf, &srl_size) == FAILURE) {
+ return;
+ }
+ rpc_msg_raw(buffer, pos, size, srl_buf, srl_size);
+ efree(srl_buf);
+ }
+
+
+ static void
+ rpc_msg_raw(char **buffer, /* data buffer */
+ int *pos, /* pointer to current buffer offset */
+ int *size, /* pointer to buffer size */
+ char *data, /* data to append to the buffer */
+ int len) /* number of bytes to append */
+ {
+ if ((*pos + len) >= *size) {
+ while ((*pos + len) >= *size) {
+ *size *= 2;
+ }
+ *buffer = erealloc(*buffer, *size);
+ }
+ memcpy(&(*buffer)[*pos], data, len);
+ *pos += len;
+ }
+
+
int
php3i_serialize(pval *val, char **resultp, int *sizep)
{
unsigned short type;
unsigned long size, value;
switch (val->type) {
case IS_STRING:
+ type = htons(RPC_TYPE_STRING);
size = htonl((unsigned long)val->value.str.len);
*sizep = sizeof(type) + sizeof(size) + val->value.str.len;
*resultp = emalloc(*sizep);
***************
*** 278,283 ****
--- 344,350 ----
val->value.str.len);
return SUCCESS;
case IS_LONG:
+ type = htons(RPC_TYPE_LONG);
value = htonl((unsigned long)val->value.lval);
*sizep = sizeof(type) + sizeof(value);
*resultp = emalloc(*sizep);
***************
*** 309,315 ****
case RPC_TYPE_STRING: {
unsigned long nlen, len;
! val->type = type;
if (size < pos + sizeof(nlen)) {
return FAILURE;
}
--- 376,382 ----
case RPC_TYPE_STRING: {
unsigned long nlen, len;
! val->type = IS_STRING;
if (size < pos + sizeof(nlen)) {
return FAILURE;
}
***************
*** 328,334 ****
case RPC_TYPE_LONG: {
unsigned long nvalue, value;
! val->type = type;
if (size < pos + sizeof(nvalue)) {
return FAILURE;
}
--- 395,401 ----
case RPC_TYPE_LONG: {
unsigned long nvalue, value;
! val->type = IS_LONG;
if (size < pos + sizeof(nvalue)) {
return FAILURE;
}
***************
*** 397,469 ****
if (php3i_unserialize(return_value, buffer, size) == FAILURE) {
RETURN_FALSE;
}
- }
-
-
- #define rpc_msg_short rpc_msg_opcode
-
- static void
- rpc_msg_opcode(char **buffer, /* data buffer */
- int *pos, /* pointer to current buffer offset */
- int *size, /* pointer to buffer size */
- unsigned short opcode) /* opcode to append to the buffer */
- {
- int len = sizeof(opcode);
- char *juks;
-
- opcode = htons(opcode);
- juks = (char *)&opcode;
- rpc_msg_raw(buffer, pos, size, juks, len);
- }
-
-
- static void
- rpc_msg_pval(char **buffer, /* data buffer */
- int *pos, /* pointer to current buffer offset */
- int *size, /* pointer to buffer size */
- pval *val) /* pval to serialize and append */
- {
- int srl_size;
- char *srl_buf;
-
- if (php3i_serialize(val, &srl_buf, &srl_size) == FAILURE) {
- return;
- }
- rpc_msg_raw(buffer, pos, size, srl_buf, srl_size);
- efree(srl_buf);
- }
-
-
- static void
- rpc_msg_long(char **buffer, /* data buffer */
- int *pos, /* pointer to current buffer offset */
- int *size, /* pointer to buffer size */
- long value) /* value to append to the buffer */
- {
- int len = sizeof(value);
- char *juks;
-
- value = htonl(value);
- juks = (char *)&value;
- rpc_msg_raw(buffer, pos, size, juks, len);
- }
-
-
- static void
- rpc_msg_raw(char **buffer, /* data buffer */
- int *pos, /* pointer to current buffer offset */
- int *size, /* pointer to buffer size */
- char *data, /* data to append to the buffer */
- int len) /* number of bytes to append */
- {
- if ((*pos + len) >= *size) {
- while ((*pos + len) >= *size) {
- *size *= 2;
- }
- *buffer = erealloc(*buffer, *size);
- }
- memcpy(&(*buffer)[*pos], data, len);
- *pos += len;
}
--- 464,469 ----
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net