CVS update: php3/functions

From: Date: Tue, 30 Mar 1999 06:23:43 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4824@lists.php.net to get a copy of this message
Date: Tuesday March 30, 1999 @ 1:23 Author: steinm Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv14685/functions Modified Files: hg_comm.c hg_comm.h hw.c Log Message: - more documentation, may now work on win32 (can't test) Index: php3/functions/hg_comm.c diff -c php3/functions/hg_comm.c:1.14 php3/functions/hg_comm.c:1.15 *** php3/functions/hg_comm.c:1.14 Tue Mar 9 12:49:55 1999 --- php3/functions/hg_comm.c Tue Mar 30 01:23:42 1999 *************** *** 23,29 **** +----------------------------------------------------------------------+ */ ! /* $Id: hg_comm.c,v 1.14 1999/03/09 17:49:55 rasmus Exp $ */ /* #define HW_DEBUG */ --- 23,29 ---- +----------------------------------------------------------------------+ */ ! /* $Id: hg_comm.c,v 1.15 1999/03/30 06:23:42 steinm Exp $ */ /* #define HW_DEBUG */ *************** *** 673,679 **** /* ** Open a TCP socket (an Internet stream socket) */ ! if((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { return(-1); } --- 673,679 ---- /* ** Open a TCP socket (an Internet stream socket) */ ! if((fd = socket(AF_INET, SOCK_STREAM, 0)) == SOCK_ERR) { return(-1); } *************** *** 941,947 **** server_addr.sin_port = htons(HG_SERVER_PORT); bcopy(hp->h_addr, (char *) &server_addr.sin_addr, hp->h_length); ! if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) { return(-2); } --- 941,947 ---- server_addr.sin_port = htons(HG_SERVER_PORT); bcopy(hp->h_addr, (char *) &server_addr.sin_addr, hp->h_length); ! if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) == SOCK_ERR ) { return(-2); } *************** *** 951,958 **** setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); #endif /* SUN */ ! if (connect(sockfd, (struct sockaddr *) &server_addr, sizeof(server_addr)) < 0) { ! close(sockfd); return(-3); } --- 951,958 ---- setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option)); #endif /* SUN */ ! if (connect(sockfd, (struct sockaddr *) &server_addr, sizeof(server_addr)) != 0) { ! SOCK_FCLOSE(sockfd); return(-3); } *************** *** 961,966 **** --- 961,967 ---- #endif if ( set_nonblocking(sockfd) == -1 ) { + SOCK_FCLOSE(sockfd); return(-4); } *************** *** 2021,2027 **** build_msg_header(&msg, length, msgid++, GETOBJECT_MESSAGE); if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - /* perror("send_command"); */ lowerror = LE_MALLOC; return(-1); } --- 2022,2027 ---- *************** *** 2057,2063 **** build_msg_header(&msg, length, msgid++, GETREMOTE_MESSAGE); if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) { - /* perror("send_command"); */ lowerror = LE_MALLOC; return(-1); } --- 2057,2062 ---- *************** *** 3948,3958 **** if(host) { if((hostptr = gethostbyname(host)) == NULL) { php3_error(E_WARNING, "gethostbyname failed for %s", host); ! close(fd); return(-1); } } else { ! close(fd); return(-1); } --- 3947,3957 ---- if(host) { if((hostptr = gethostbyname(host)) == NULL) { php3_error(E_WARNING, "gethostbyname failed for %s", host); ! SOCK_FCLOSE(fd); return(-1); } } else { ! SOCK_FCLOSE(fd); return(-1); } *************** *** 3965,3984 **** hostip = inet_ntoa(*ptr1); break; default: ! close(fd); return(-1); break; } /* Bottom half of send_getobject */ if(0 > bh_send_getobject(sockfd, objectID)) { ! close(fd); return -1; } /* Upper half of send_getobject */ if(0 > (error = uh_send_getobject(sockfd, &attributes))) { ! close(fd); return error; } --- 3964,3983 ---- hostip = inet_ntoa(*ptr1); break; default: ! SOCK_FCLOSE(fd); return(-1); break; } /* Bottom half of send_getobject */ if(0 > bh_send_getobject(sockfd, objectID)) { ! SOCK_FCLOSE(fd); return -1; } /* Upper half of send_getobject */ if(0 > (error = uh_send_getobject(sockfd, &attributes))) { ! SOCK_FCLOSE(fd); return error; } *************** *** 3998,4004 **** if ( send_hg_msg(sockfd, &msg, length) == -1 ) { if(attributes) efree(attributes); efree(msg.buf); ! close(fd); return(-1); } efree(msg.buf); --- 3997,4003 ---- if ( send_hg_msg(sockfd, &msg, length) == -1 ) { if(attributes) efree(attributes); efree(msg.buf); ! SOCK_FCLOSE(fd); return(-1); } efree(msg.buf); *************** *** 4007,4013 **** retmsg = recv_hg_msg(sockfd); if ( retmsg == NULL ) { if(attributes) efree(attributes); ! close(fd); return(-1); } --- 4006,4012 ---- retmsg = recv_hg_msg(sockfd); if ( retmsg == NULL ) { if(attributes) efree(attributes); ! SOCK_FCLOSE(fd); return(-1); } *************** *** 4017,4023 **** efree(retmsg); if(retmsg->buf) efree(retmsg->buf); if(attributes) efree(attributes); ! close(fd); return(error); } --- 4016,4022 ---- efree(retmsg); if(retmsg->buf) efree(retmsg->buf); if(attributes) efree(attributes); ! SOCK_FCLOSE(fd); return(error); } *************** *** 4031,4040 **** if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) { /* php3_printf("client: can't open data connection to server\n"); */ if(attributes) efree(attributes); ! close(fd); return(-1); } else { ! close(fd); } /* First of all read the header */ --- 4030,4039 ---- if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) { /* php3_printf("client: can't open data connection to server\n"); */ if(attributes) efree(attributes); ! SOCK_FCLOSE(fd); return(-1); } else { ! SOCK_FCLOSE(fd); } /* First of all read the header */ *************** *** 4058,4064 **** } /* close the data connection */ ! close(newfd); documenttype = fnAttributeValue(attributes, "DocumentType"); --- 4057,4063 ---- } /* close the data connection */ ! SOCK_FCLOSE(newfd); documenttype = fnAttributeValue(attributes, "DocumentType"); *************** *** 4125,4135 **** if(host) { if((hostptr = gethostbyname(host)) == NULL) { php3_error(E_WARNING, "gethostbyname failed for %s", host); ! close(fd); return(-1); } } else { ! close(fd); return(-1); } --- 4124,4134 ---- if(host) { if((hostptr = gethostbyname(host)) == NULL) { php3_error(E_WARNING, "gethostbyname failed for %s", host); ! SOCK_FCLOSE(fd); return(-1); } } else { ! SOCK_FCLOSE(fd); return(-1); } *************** *** 4148,4160 **** /* Bottom half of send_getobject */ if(0 > bh_send_getobject(sockfd, objectID)) { ! close(fd); return -1; } /* Upper half of send_getobject */ if(0 > (error = uh_send_getobject(sockfd, &attributes))) { ! close(fd); return error; } --- 4147,4159 ---- /* Bottom half of send_getobject */ if(0 > bh_send_getobject(sockfd, objectID)) { ! SOCK_FCLOSE(fd); return -1; } /* Upper half of send_getobject */ if(0 > (error = uh_send_getobject(sockfd, &attributes))) { ! SOCK_FCLOSE(fd); return error; } *************** *** 4181,4187 **** if ( send_hg_msg(sockfd, &msg, length) == -1 ) { if(attributes) efree(attributes); efree(msg.buf); ! close(fd); return(-1); } efree(msg.buf); --- 4180,4186 ---- if ( send_hg_msg(sockfd, &msg, length) == -1 ) { if(attributes) efree(attributes); efree(msg.buf); ! SOCK_FCLOSE(fd); return(-1); } efree(msg.buf); *************** *** 4190,4196 **** retmsg = recv_hg_msg(sockfd); if ( retmsg == NULL ) { if(attributes) efree(attributes); ! close(fd); return(-1); } --- 4189,4195 ---- retmsg = recv_hg_msg(sockfd); if ( retmsg == NULL ) { if(attributes) efree(attributes); ! SOCK_FCLOSE(fd); return(-1); } *************** *** 4199,4205 **** efree(retmsg); if(retmsg->buf) efree(retmsg->buf); if(attributes) efree(attributes); ! close(fd); return(-1); } --- 4198,4204 ---- efree(retmsg); if(retmsg->buf) efree(retmsg->buf); if(attributes) efree(attributes); ! SOCK_FCLOSE(fd); return(-1); } *************** *** 4212,4221 **** len = sizeof(serv_addr); if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) { if(attributes) efree(attributes); ! close(fd); return(-1); } else { ! close(fd); } /* First of all read the header */ --- 4211,4220 ---- len = sizeof(serv_addr); if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) { if(attributes) efree(attributes); ! SOCK_FCLOSE(fd); return(-1); } else { ! SOCK_FCLOSE(fd); } /* First of all read the header */ *************** *** 4238,4244 **** } /* close the data connection */ ! close(newfd); documenttype = fnAttributeValue(attributes, "DocumentType"); --- 4237,4243 ---- } /* close the data connection */ ! SOCK_FCLOSE(newfd); documenttype = fnAttributeValue(attributes, "DocumentType"); *************** *** 4353,4359 **** if ( send_hg_msg(sockfd, &msg, length) == -1 ) { efree(msg.buf); ! close(fd); return(-1); } efree(msg.buf); --- 4352,4358 ---- if ( send_hg_msg(sockfd, &msg, length) == -1 ) { efree(msg.buf); ! SOCK_FCLOSE(fd); return(-1); } efree(msg.buf); *************** *** 4363,4372 **** */ len = sizeof(serv_addr); if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) { ! close(fd); return(-1); } else { ! close(fd); } /* First of all write the header. According to the documentation --- 4362,4371 ---- */ len = sizeof(serv_addr); if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) { ! SOCK_FCLOSE(fd); return(-1); } else { ! SOCK_FCLOSE(fd); } /* First of all write the header. According to the documentation *************** *** 4378,4401 **** sprintf(header, "HGHDR\nsz=%d\nref=12345678\n", count); len = strlen(header) + 1; if(len != write_to(newfd, header, len, wtimeout)) { ! close(newfd); return(-1); } /* And now the document */ if(count != write_to(newfd, text, count, wtimeout)) { ! close(newfd); return(-1); } /* The data connection has to be close before the return msg can be read. The server will not sent it before. */ ! close(newfd); /* Just check if the command was understood */ retmsg = recv_hg_msg(sockfd); if ( retmsg == NULL ) { ! close(fd); return(-1); } --- 4377,4400 ---- sprintf(header, "HGHDR\nsz=%d\nref=12345678\n", count); len = strlen(header) + 1; if(len != write_to(newfd, header, len, wtimeout)) { ! SOCK_FCLOSE(newfd); return(-1); } /* And now the document */ if(count != write_to(newfd, text, count, wtimeout)) { ! SOCK_FCLOSE(newfd); return(-1); } /* The data connection has to be close before the return msg can be read. The server will not sent it before. */ ! SOCK_FCLOSE(newfd); /* Just check if the command was understood */ retmsg = recv_hg_msg(sockfd); if ( retmsg == NULL ) { ! SOCK_FCLOSE(fd); return(-1); } *************** *** 4403,4409 **** if((ptr == NULL) || (*ptr != 0)) { efree(retmsg); if(retmsg->buf) efree(retmsg->buf); ! close(fd); return(-1); } --- 4402,4408 ---- if((ptr == NULL) || (*ptr != 0)) { efree(retmsg); if(retmsg->buf) efree(retmsg->buf); ! SOCK_FCLOSE(fd); return(-1); } *************** *** 4696,4703 **** void close_hg_connection(int sockfd) { ! shutdown(sockfd, 2); ! close(sockfd); } #endif --- 4695,4702 ---- void close_hg_connection(int sockfd) { ! shutdown(sockfd, 2); ! SOCK_FCLOSE(sockfd); } #endif Index: php3/functions/hg_comm.h diff -c php3/functions/hg_comm.h:1.4 php3/functions/hg_comm.h:1.5 *** php3/functions/hg_comm.h:1.4 Thu Jan 14 12:47:50 1999 --- php3/functions/hg_comm.h Tue Mar 30 01:23:42 1999 *************** *** 23,29 **** */ ! /* $Id: hg_comm.h,v 1.4 1999/01/14 17:47:50 steinm Exp $ */ #ifndef _HG_COMM_H #define _HG_COMM_H --- 23,29 ---- */ ! /* $Id: hg_comm.h,v 1.5 1999/03/30 06:23:42 steinm Exp $ */ #ifndef _HG_COMM_H #define _HG_COMM_H *************** *** 87,92 **** --- 87,102 ---- #define MOVE 1 #define DOCUMENT 0 #define COLLECTION 1 + + #if WIN32|WINNT + # define SOCK_ERR INVALID_SOCKET + # define SOCK_CONN_ERR SOCKET_ERROR + # define SOCK_FCLOSE(s) closesocket(s) + #else + # define SOCK_ERR -1 + # define SOCK_CONN_ERR -1 + # define SOCK_FCLOSE(s) close(s) + #endif /* Low error messages */ #define LE_MALLOC -1 Index: php3/functions/hw.c diff -c php3/functions/hw.c:1.25 php3/functions/hw.c:1.26 *** php3/functions/hw.c:1.25 Thu Mar 25 01:27:48 1999 --- php3/functions/hw.c Tue Mar 30 01:23:43 1999 *************** *** 23,29 **** +----------------------------------------------------------------------+ */ ! /* $Id: hw.c,v 1.25 1999/03/25 06:27:48 steinm Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" #endif --- 23,29 ---- +----------------------------------------------------------------------+ */ ! /* $Id: hw.c,v 1.26 1999/03/30 06:23:43 steinm Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" #endif *************** *** 1711,1717 **** } /* }}} */ ! /* {{{ proto [array|int] hw_getremotechildren(int link, int objid) Returns the remote document or an array of object records */ void php3_hw_getremotechildren(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; --- 1711,1717 ---- } /* }}} */ ! /* {{{ proto [array|int] hw_getremotechildren(int link, string objrec) Returns the remote document or an array of object records */ void php3_hw_getremotechildren(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; *************** *** 1764,1769 **** --- 1764,1771 ---- returns a docuement will not be shown unless the MimeType is set. It returns the pure object record of the object without the SQLStatement attribute. Quite senseless. + Though, this behavior depends on how the hgi gateway in Hyperwave + is implemented. */ if(strncmp(remainder, "ObjectID=0 ", 10)) { hw_document *doc; -- 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

« previous php.dev (#4824) next »