cvs: /php4/ext/hyperwave hg_comm.c hg_comm.h hw.c php3_hyperwave.h

From: Date: Thu, 21 Oct 1999 15:15:54 +0000
Subject: cvs: /php4/ext/hyperwave hg_comm.c hg_comm.h hw.c php3_hyperwave.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-5628@lists.php.net to get a copy of this message
steinm Thu Oct 21 11:15:54 1999 EDT Modified files: /php4/ext/hyperwave hg_comm.c hg_comm.h hw.c php3_hyperwave.h Log: Added hw_mapid(), read comment in hg_comm.c Index: php4/ext/hyperwave/hg_comm.c diff -u php4/ext/hyperwave/hg_comm.c:1.13 php4/ext/hyperwave/hg_comm.c:1.14 --- php4/ext/hyperwave/hg_comm.c:1.13 Tue Oct 19 09:54:44 1999 +++ php4/ext/hyperwave/hg_comm.c Thu Oct 21 11:15:23 1999 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: hg_comm.c,v 1.13 1999/10/19 13:54:44 steinm Exp $ */ +/* $Id: hg_comm.c,v 1.14 1999/10/21 15:15:23 steinm Exp $ */ /* #define HW_DEBUG */ @@ -68,8 +68,11 @@ virtual. This means whenever an object is requested a new id is generated for this session. Wavemaster and Harmony set this flag. How do I know? tcpdump tells - a lot if investigate the output. - int version = HW_VERSION | F_DISTRIBUTED; */ + a lot if the output is investigated. The bit is also + need to allow access on other server through the local + server. The hw_mapid() function won't work unless you + set F_DISTRIBUTED */ +/* int version = HW_VERSION | F_DISTRIBUTED; */ /* int version = HW_VERSION | F_DISTRIBUTED | F_COMPRESSED; */ static int msgid = 1; static int sock_flags = -1; @@ -516,7 +519,10 @@ break; default: newtext = fnInsStr(newtext, cur_ptr->end+offset, "</A>"); - snprintf(istr, BUFFERLEN, "<A HREF='%s' %s>", cur_ptr->link, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); + if(cur_ptr->fragment) + snprintf(istr, BUFFERLEN, "<A HREF='%s#%s' %s>", cur_ptr->link, cur_ptr->fragment, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); + else + snprintf(istr, BUFFERLEN, "<A HREF='%s' %s>", cur_ptr->link, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); } } else { switch(cur_ptr->linktype) { @@ -4677,6 +4683,53 @@ } } } + } + + return(0); +} + +int send_mapid(int sockfd, int servid, hw_objectID id, int *virtid) +{ + hg_msg msg, *retmsg; + int length, i, error; + char *tmp; + int *ptr, *ptr1; + + length = HEADER_LENGTH + 2 * sizeof(hw_objectID); + + build_msg_header(&msg, length, msgid++, HG_MAPID); + + if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { + lowerror = LE_MALLOC; + return(-1); + } + + tmp = build_msg_int(msg.buf, servid); + tmp = build_msg_int(tmp, id); + + if (-1 == send_hg_msg(sockfd, &msg, length)) { + efree(msg.buf); + return(-2); + } + + efree(msg.buf); + retmsg = recv_hg_msg(sockfd); + if ( retmsg == NULL ) { + return(-3); + } + + ptr = (int *) retmsg->buf; + if(ptr == NULL) { + if(retmsg) efree(retmsg); + return -1; + } + if(*ptr++ == 0) { + *virtid = *ptr; + } else { + error = *((int *) retmsg->buf); + efree(retmsg->buf); + efree(retmsg); + return error; } return(0); Index: php4/ext/hyperwave/hg_comm.h diff -u php4/ext/hyperwave/hg_comm.h:1.4 php4/ext/hyperwave/hg_comm.h:1.5 --- php4/ext/hyperwave/hg_comm.h:1.4 Fri Aug 6 06:41:58 1999 +++ php4/ext/hyperwave/hg_comm.h Thu Oct 21 11:15:23 1999 @@ -23,7 +23,7 @@ */ -/* $Id: hg_comm.h,v 1.4 1999/08/06 10:41:58 steinm Exp $ */ +/* $Id: hg_comm.h,v 1.5 1999/10/21 15:15:23 steinm Exp $ */ #ifndef _HG_COMM_H #define _HG_COMM_H @@ -74,6 +74,7 @@ #define PUTDOCUMENT_MESSAGE 38 #define GETREMOTE_MESSAGE 39 #define GETREMOTECHILDREN_MESSAGE 40 +#define HG_MAPID 43 #define CHILDREN_MESSAGE 44 #define GETCGI_MESSAGE 45 #define PIPECGI_MESSAGE 46 @@ -200,6 +201,7 @@ extern int send_insdoc(int sockfd, hw_objectID objectID, char *objrec, char *text, hw_objectID *new_objectID); extern int send_incollections(int sockfd, int retcol, int cobjids, hw_objectID *objectIDs, int ccollids, hw_objectID *collIDs, int *count, hw_objectID **retIDs); extern int send_getsrcbydest(int sockfd, hw_objectID objid, char ***childrec, int *count); +extern int send_mapid(int sockfd, int servid, hw_objectID id, int *virtid); extern int send_dummy(int sockfd, hw_objectID objectID, int msgid, char **attributes); extern char *get_hw_info(hw_connection *conn); Index: php4/ext/hyperwave/hw.c diff -u php4/ext/hyperwave/hw.c:1.23 php4/ext/hyperwave/hw.c:1.24 --- php4/ext/hyperwave/hw.c:1.23 Tue Oct 19 09:54:44 1999 +++ php4/ext/hyperwave/hw.c Thu Oct 21 11:15:23 1999 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: hw.c,v 1.23 1999/10/19 13:54:44 steinm Exp $ */ +/* $Id: hw.c,v 1.24 1999/10/21 15:15:23 steinm Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" #endif @@ -110,6 +110,7 @@ PHP_FE(hw_getrellink, NULL) PHP_FE(hw_who, NULL) PHP_FE(hw_stat, NULL) + PHP_FE(hw_mapid, NULL) PHP_FE(hw_dummy, NULL) {NULL, NULL, NULL} }; @@ -3583,6 +3584,37 @@ /* create return value and free all memory */ if( 0 > make_return_objrec(&return_value, childObjRecs, count)) RETURN_FALSE; +} +/* }}} */ + +/* {{{ proto int hw_mapid(int link, int serverid, int destid) + Returns virtual object id of document on remote hw server */ +PHP_FUNCTION(hw_mapid) { + pval *arg1, *arg2, *arg3; + int link, type, servid, id, virtid; + hw_connection *ptr; + + if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_long(arg1); + convert_to_long(arg2); + convert_to_long(arg3); + link=arg1->value.lval; + servid=arg2->value.lval; + id=arg3->value.lval; + ptr = php3_list_find(link,&type); + if(!ptr || (type!=HwSG(le_socketp) && type!=HwSG(le_psocketp))) { + php3_error(E_WARNING,"Unable to find file identifier %d",link); + RETURN_FALSE; + } + + set_swap(ptr->swap_on); + if (0 != (ptr->lasterror = send_mapid(ptr->socket, servid, id, &virtid))) { + php3_error(E_WARNING, "send_command (mapid) returned %d\n", ptr->lasterror); + RETURN_FALSE; + } + RETURN_LONG(virtid); } /* }}} */ Index: php4/ext/hyperwave/php3_hyperwave.h diff -u php4/ext/hyperwave/php3_hyperwave.h:1.2 php4/ext/hyperwave/php3_hyperwave.h:1.3 --- php4/ext/hyperwave/php3_hyperwave.h:1.2 Fri Aug 6 06:41:58 1999 +++ php4/ext/hyperwave/php3_hyperwave.h Thu Oct 21 11:15:23 1999 @@ -23,7 +23,7 @@ */ -/* $Id: php3_hyperwave.h,v 1.2 1999/08/06 10:41:58 steinm Exp $ */ +/* $Id: php3_hyperwave.h,v 1.3 1999/10/21 15:15:23 steinm Exp $ */ #ifndef _HW_H #define _HW_H @@ -156,6 +156,7 @@ PHP_FUNCTION(hw_dummy); PHP_FUNCTION(hw_who); PHP_FUNCTION(hw_stat); +PHP_FUNCTION(hw_mapid); #else #define hw_module_ptr NULL

« previous php.version4 (#5628) next »