diff options
Diffstat (limited to 'ACE/apps/JAWS/clients/WebSTONE/src')
69 files changed, 14807 insertions, 0 deletions
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/README b/ACE/apps/JAWS/clients/WebSTONE/src/README new file mode 100755 index 00000000000..2061342b7ae --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/README @@ -0,0 +1,232 @@ +README WebStone 2.0 Release version + +WARNING: WebStone 2.0 results should not be compared with WebStone 1.1 + results. Even under the same fileset performance will not be + equivalent. + +Please see the notes for 2.0beta6 for quick and dirty install + This version includes a port of the webstone source code to Windows +NT. This port is still in progress, so it is not possible to guarantee +that everything is working correctly - however in our test configurations +it has performed correctly. Note that the supporting scripts and report +generating code has not been ported to NT yet. + + This version also institutes some basic run rules to eliminate the +lack of conformity in Webstone performance quotes. + To report Webstone numbers, some basic rules should be followed: + + 1) The fileset used for the test must be the fileset.standard fileset + included in the distribution. Tests of CGI performance must be + with the file filelist.cgi-heavy, and tests of NSAPI performance + must be carried out with filelist.dynamic-heavy + + 2) The run time should be set for 10 minutes, and the number of + clients should vary from 20 clients to 100 clients in increments + of 10. When a connections/second time is quoted, it must include + information about the number of clients involved. + + 3) Any special TCP/IP tuning which the server has recieved should + be documented, as well as HTTPD server version and configuration + information such as logging, DNS lookups and number of threads. + + +README - WebStone 2.0beta6 + +WARNING: Do not compare WebStone 2.0 results with WebStone 1.0 results. + WebStone 2.0 introduces significant changes in testing methodology + and reporting. + +This is the WebStone benchmark. Quick and dirty install: + - set up a Web server + - put this directory (WebStone) on a seperate machine (the "controller") + - "./webstone -setup", which does the following: + - gui-configure + This script may fail if you don't have a Web browser or + Perl5. Don't worry, unless you want to use the GUI. + - autoconf + If the GNU autoconf fails for your OS, please forward the + error messages, and any porting hints, to the author. + - make install + This may not be necessary, since IRIX binaries are included. + - edit conf/testbed to reflect your site + See the doc/FAQ-webstone.html for details. + - ./webstone -genfiles will put the files in conf/fileset + onto your Web server. + - ./webstone + - to display a table of results: ./webstone -results + +If you'd like to try out the GUI for WebStone: + - run "./webstone -setup", as above. + - make sure you have a Web browser installed + - ./configure + - ./webstone -gui + +Files of interest: + README: This document. + README.FIRST: Quick and dirty directions. + README.DynamicWorkload: Information on the CGI and NSAPI workloads. + webstone: wrapper shell script for everything. + Takes options: + -gui: start the GUI mode + -kill: kill stray WebStone processes + -genfiles: build files (from conf/fileset) + and rcp onto the server $SERVER + - results: print table of results + -setup: initial make and setup + -silent: runs in the background + -tail: tail -f of most recent run + +Files of interest (./src): + Makefile, *.c, *.h: The Webstone source code + +Files of interest (./bin): + checkfilelist: uses rsh to check web server for files in filelist. + genfiles, genrand: generates files of arbitrary length. + getstats: Collects network statistics from Web server, clients. + killbench: terminates stray WebStone processes. + rebootall: reboots all WebStone webclients. + runbench: wrapper script for WebStone. + webmaster: WebStone controller executable. + webstone: WebStone client executable. + wscollect: reports results in tabular format. + +Files of interest (./conf): + filelist: default list of files on the Web server, + with workload description. + filelist.photo: Model of a popular Web site + containing photographic images. + filelist.ss: Model of SGI's Silicon Surf WWW site. + fileset: list of files for genfiles to create. + testbed: config file describing Web server, client, and network setup. + +Documentation (./doc): + FAQ.html: The FAQ, current as of this distribution. + LICENSE: Legal status of WebStone. + testbed.help: Explains the parameters in conf/testbed. + webstone-white-paper.ps: The original WebStone white paper. + webstone.gif: The WebStone logo. + +Additional documentation: + FAQ.html: Frequently Asked Questions, with answers + webstone.ps: PostScript white paper on WebStone + +Problems, etc. may be addressed to the WebStone mailing list. +Read the FAQ for details. + +Release Notes (2.0 beta6): + * fixed a bug for Web servers not on port 80 + * further changes to bin/wscollect.pl + +Release Notes (2.0 beta5): + * numerous minor fixes suggested by gcc -Wall -pedantic + * updated FAQ + * changed bin/wscollect.pl to use Perl formats + +Release Notes (2.0 beta4): + * added #include <sys/time.h> to bench.h + * changed webclient located to $TMPDIR - this should help people + who don't want to run WebStone as root + * changed check for libm to floor() instead of sqrt(). Apparently + some systems implement sqrt() in libc - let's hope no one implement + floor() in libc and sqrt() in libm! + +Release Notes (2.0 beta3): + * more portability fixes + * successfully compiled on FreeBSD 2.2, IRIX without any source + changes + +Release Notes (2.0 beta2): + * additional timezone fixes for SunOS + +Release Notes (2.0 beta1): + * fixed a bug in the rexec portion of webmaster.c + * fixed a bug in the usage() routine of webmaster.c + * added bin/genfiles-from-filelist.sh + - bin/genfiles-from-filelist.sh <filename> + - generates appropriate-length files from <filename> + - <filename> must contain three fields: + <relative URL> <weight> #<size in bytes> + example: /file.html 1 #1024 + * added bin/mine-logs.pl + - usage: mine-logs.pl <filename> + where <filename> is an http server log file + - writes a WebStone workload to standard output + +Release Notes (2.0 alpha5): + * revised default testbed file + * changed wscollect to wscollect.pl for consistency + * changed webstone-gui to webstone-gui.pl for consistency + * added some NT porting hints + * added autoconf, which should help Linux and SunOS porting + +Release Notes (2.0 alpha4): + * added SunOS and Linux portability elements + * new scheme for random access to pages + * converted several static arrays to dynamic pointers + +Release Notes (2.0 alpha2): + * fixed per-page statistics + * new, client-independent data-passing scheme + * added support for proxy servers + +Release Notes (2.0 alpha1): + * new filelist scheme - however, this breaks per-page statistics + * minor fixes + +Release Notes (1.1): + * Improved webclient performance by combining GET and ACCEPT + HTTP headers in one write() call. + * Improved webclient performance on systems that always attempt + to map protocol names to numbers using YP. + * WARNING: since the old code introduced a significant latency + in some systems, DO NOT compare WebStone 1.1 results + with results generated by any previous versions. + +Release Notes (1.0.3): + * Netscape Server 1.1.2 exposed a couple bugs, which I've now fixed. + +Release Notes (1.0.2): + * Fixed runbench so that ITERATIONS, MINCLIENTS, and MAXCLIENTS don't + have to have a common denominator any more. + * Fixed a few cosmetic bugs. + +Release Notes (1.0.1): + * Fixed select() bug in webmaster + +Release Notes (1.0 final): + * Fixed the "Error reading 2nd timing info" bug + * Fixed numerous bugs in the GUI + * Froze feature set. Work can now begin on WebStone 1.1 + +Release Notes (1.0b3): + * New Web browser GUI + NOTE: most Web browsers take up substantial CPU time. + If you run the GUI, we recommend that you make the controller + a separate machine, and don't run any WebStone clients on it. + * Minor bug fixes + Squashed some dubious error messages, fixed some client- + controller communications problems. + * Reporting changes + Changes the units and order of the final summary statistics. + Basically, this is for my own convenience, so I don't have to + massage the data quite so much before using it. wscollect + now reports only the metrics I regard as important - but all + metrics are still reported in the runs/*/run files. + +LEGAL STUFF: + +This file and all files contained in this directory are +copyright 1995, Silicon Graphics, Inc. + +This software is provided without support and without any obligation on the +part of Silicon Graphics, Inc. to assist in its use, correction, modification +or enhancement. There is no guarantee that this software will be included in +future software releases, and it probably will not be included. + +THIS SOFTWARE IS PROVIDED "AS IS" WITH NO WARRANTIES OF ANY KIND INCLUDING THE +WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE, +OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + +In no event will Silicon Graphics, Inc. be liable for any lost revenue or +profits or other special, indirect and consequential damages, even if +Silicon Graphics, Inc. has been advised of the possibility of such damages. diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/acconfig.h b/ACE/apps/JAWS/clients/WebSTONE/src/acconfig.h new file mode 100644 index 00000000000..2183ecd4a7f --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/acconfig.h @@ -0,0 +1,15 @@ +/* $Id$ */ +/* Special definitions for autoheader + Copyright (C) 1995 Silicon Graphics, Inc. +*/ + +/* Define to the name of the distribution. */ +#undef PRODUCT + +/* Define to the version of the distribution. */ +#undef VERSION + +/* Should we use timezone in gettimeofday? */ +#undef USE_TIMEZONE + +/* end */ diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/bench.c b/ACE/apps/JAWS/clients/WebSTONE/src/bench.c new file mode 100644 index 00000000000..54e6147ba4d --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/bench.c @@ -0,0 +1,635 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +/* FUZZ: disable check_for_math_include */ + +#include <stdio.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <math.h> +#include <limits.h> +#include <float.h> +#ifndef WIN32 +#include <unistd.h> +#include <sys/time.h> +#include <sys/uio.h> +#include <sys/param.h> +#include <netdb.h> +#else +#include <windows.h> +#include <winsock.h> +#endif /* WIN32 */ +#include "sysdep.h" +#include "bench.h" + + +/* allocate memory and exit if out of memory */ +void *mymalloc(size_t size) { +void *ptr; + + ptr = malloc(size); + if (ptr == NULL) + errexit("Call to malloc() failed\n"); + return ptr; +} + +/* + * Receive n bytes from a socket + */ +int +recvdata(SOCKET sock, char *ptr, int nbytes) { + + int nleft, nread; + + nleft = nbytes; + while (nleft > 0) + { + D_PRINTF( "In recvdata(%d, %d)\n", sock, nleft ); + nread = NETREAD(sock, ptr, nleft); + D_PRINTF( "NETREAD() returned %d\n", nread ); + if (BADSOCKET(nread) || nread == 0) + { + /* return error value NETWRITE */ + D_PRINTF( "Error in recvdata(): %s\n",neterrstr() ); + return(nread); + } + + D_PRINTF( "NETREAD() data: \"%.*s\"\n", nread, ptr); + nleft -= nread; + ptr += nread; + } /* end while */ + + /* return >= 0 */ + return(nbytes - nleft); + +} /* end recvdata */ + + +/* + * Send n bytes to a socket + */ +int +senddata(SOCKET sock, char *ptr, int nbytes) { + int nleft, nwritten; + + D_PRINTF( "In senddata(%d, \"%.*s\", %d)\n", sock, nbytes, ptr, nbytes ); + nleft = nbytes; + while (nleft > 0) + { + nwritten = NETWRITE(sock, ptr, nleft); + D_PRINTF( "senddata() returned %d\n", nwritten ); + if (BADSOCKET(nwritten)) + { + /* return error value from NETWRITE */ + D_PRINTF( "Error in senddata(): %s\n", neterrstr() ); + return(nwritten); + } + nleft -= nwritten; + ptr += nwritten; + } + return(nbytes - nleft); + +} /* end senddata */ + +/* GENERAL NOTE: the conversion routines that follow pass their results + * back in a static arrays. A second call to the same routine overwrites + * the previous buffer value for that routine. If you want to save the + * value in the buffer copy it to another variable. + */ + +char * +timeval_to_text(const struct timeval *the_timeval) { + /* + * given a timeval (seconds and microseconds), put the text + * "seconds.microseconds" into timeval_as_text + */ + THREAD static char timeval_as_text[SIZEOF_TIMEVALTEXT+1]; + int seconds, microseconds; + int returnval = 0; + + seconds = the_timeval->tv_sec; + microseconds = the_timeval->tv_usec; + returnval = sprintf(timeval_as_text, + "%10d.%6.6d\t", seconds, microseconds); + return timeval_as_text; +} + + +char * +double_to_text(const double the_double) { + /* + * given a double, return text + */ + THREAD static char double_as_text[SIZEOF_DOUBLETEXT + 1]; + int returnval = 0; + + returnval = sprintf(double_as_text, "%17.01f\t", the_double); + return(double_as_text); +} + +struct timeval +text_to_timeval(char *timeval_as_text) { + int returnval = 0; + long int seconds, microseconds; + struct timeval the_timeval; + + D_PRINTF("T/%d %s\n", (int)timeval_as_text, timeval_as_text); + returnval = sscanf(timeval_as_text, "%ld.%ld", + &seconds, µseconds); + the_timeval.tv_sec = seconds; + the_timeval.tv_usec = microseconds; + return the_timeval; +} + +double +text_to_double(char *double_as_text) { + double the_double = 0; + int returnval = 0; + + D_PRINTF("D/%d %s\n", (int)double_as_text, double_as_text); + returnval = sscanf(double_as_text, "%lf", &the_double); + return(the_double); +} + + +rqst_stats_t * +text_to_rqst_stats(char *rqst_stats_as_text) { + THREAD static rqst_stats_t rqst_stats; + rqst_stats_t *the_rqst_stats = &rqst_stats; + + the_rqst_stats->totalresponsetime = + text_to_timeval(strtok(rqst_stats_as_text, "\t")); + + the_rqst_stats->totalresponsetimesq = + text_to_double(strtok((char *)NULL, "\t")); + + the_rqst_stats->minresponsetime = + text_to_timeval(strtok((char *)NULL, "\t")); + + the_rqst_stats->maxresponsetime = + text_to_timeval(strtok((char *)NULL, "\t")); + + the_rqst_stats->totalconnecttime = + text_to_timeval(strtok((char *)NULL, "\t")); + + the_rqst_stats->totalconnecttimesq = + text_to_double(strtok((char *)NULL, "\t")); + + the_rqst_stats->minconnecttime = + text_to_timeval(strtok((char *)NULL, "\t")); + + the_rqst_stats->maxconnecttime = + text_to_timeval(strtok((char *)NULL, "\t")); + + the_rqst_stats->totalconnects = (unsigned long) + text_to_double(strtok((char *)NULL, "\t")); + + the_rqst_stats->totalerrs = (unsigned long) + text_to_double(strtok((char *)NULL, "\t")); + + the_rqst_stats->totalerrortime = + text_to_timeval(strtok((char *)NULL, "\t")); + + the_rqst_stats->totalbytes = + text_to_double(strtok((char *)NULL, "\t")); + + the_rqst_stats->totalbytessq = + text_to_double(strtok((char *)NULL, "\t")); + + the_rqst_stats->minbytes = + text_to_double(strtok((char *)NULL, "\t")); + + the_rqst_stats->maxbytes = + text_to_double(strtok((char *)NULL, "\t")); + + the_rqst_stats->totalbody = + text_to_double(strtok((char *)NULL, "\t")); + + the_rqst_stats->totalbodysq = + text_to_double(strtok((char *)NULL, "\t")); + + the_rqst_stats->minbody = + text_to_double(strtok((char *)NULL, "\t")); + + the_rqst_stats->maxbody = + text_to_double(strtok((char *)NULL, "\t")); + + return(the_rqst_stats); +} /* end text_to_rqst_stats */ + + +char * +rqst_stats_to_text(rqst_stats_t *the_rqst_stats) { + THREAD static char rqst_stats_as_text[SIZEOF_RQSTSTATSTEXT]; + char *tmpbuf; + + *rqst_stats_as_text = 0; + + tmpbuf = timeval_to_text(&(the_rqst_stats->totalresponsetime)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->totalresponsetimesq)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = timeval_to_text(&(the_rqst_stats->minresponsetime)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = timeval_to_text(&(the_rqst_stats->maxresponsetime)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = timeval_to_text(&(the_rqst_stats->totalconnecttime)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->totalconnecttimesq)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = timeval_to_text(&(the_rqst_stats->minconnecttime)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = timeval_to_text(&(the_rqst_stats->maxconnecttime)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->totalconnects)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->totalerrs)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = timeval_to_text(&(the_rqst_stats->totalerrortime)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->totalbytes)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->totalbytessq)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->minbytes)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->maxbytes)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->totalbody)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->totalbodysq)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->minbody)); + strcat(rqst_stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_rqst_stats->maxbody)); + strcat(rqst_stats_as_text, tmpbuf); + + D_PRINTF( "rqst_stats_to_text returning %d: %s\n", + strlen(rqst_stats_as_text), + rqst_stats_as_text ); + + return(rqst_stats_as_text); +} + + +stats_t * +text_to_stats(char *stats_as_text) { + int i; + rqst_stats_t *the_rqst_stats; + THREAD static stats_t stats; + stats_t *the_stats = &stats; + + D_PRINTF( "Parsing stats: %s\n", stats_as_text ); + /* grab stats.rs */ + the_rqst_stats = text_to_rqst_stats(stats_as_text); + the_stats->rs = *the_rqst_stats; + + /* grab main structure */ + the_stats->starttime = text_to_timeval(strtok((char *)NULL, "\t")); + the_stats->endtime = text_to_timeval(strtok((char *)NULL, "\t")); + the_stats->datatime = text_to_timeval(strtok((char *)NULL, "\t")); + the_stats->totalpages = (unsigned long) text_to_double(strtok((char *)NULL, "\t")); + the_stats->total_num_of_files = (unsigned int) text_to_double(strtok((char *)NULL, "\t")); + for (i = 0; i < number_of_pages; i++) + { + the_stats->page_numbers[i] = (unsigned int) text_to_double(strtok((char *)NULL, "\t")); + } + /* return bytes read */ + D_PRINTF( "Returning stats\n"); + return(the_stats); +} /* end text_to_stats */ + + + +char * +stats_to_text(const stats_t *the_stats) { + int i; + THREAD static char stats_as_text[SIZEOF_STATSTEXT]; + char *tmpbuf; + rqst_stats_t the_rqst_stats; + + *stats_as_text = 0; + + /* stats.rs */ + the_rqst_stats = the_stats->rs; + tmpbuf = rqst_stats_to_text(&the_rqst_stats); + strcat(stats_as_text, tmpbuf); + + /* main structure */ + + tmpbuf = timeval_to_text(&(the_stats->starttime)); + strcat(stats_as_text, tmpbuf); + + tmpbuf = timeval_to_text(&(the_stats->endtime)); + strcat(stats_as_text, tmpbuf); + + tmpbuf = timeval_to_text(&(the_stats->datatime)); + strcat(stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_stats->totalpages)); + strcat(stats_as_text, tmpbuf); + + tmpbuf = double_to_text((the_stats->total_num_of_files)); + strcat(stats_as_text, tmpbuf); + + for (i = 0; i < number_of_pages; i++) + { + tmpbuf = double_to_text((the_stats->page_numbers[i])); + strcat(stats_as_text, tmpbuf); + } + + strcat(stats_as_text, "\n"); + + return(stats_as_text); +} /* end stats_to_text */ + + + +page_stats_t * +text_to_page_stats(char *page_stats_as_text) { + rqst_stats_t *the_rqst_stats; + THREAD static page_stats_t pagestat; + page_stats_t *pagestats = &pagestat; + + /* grab stats.rs */ + the_rqst_stats = text_to_rqst_stats(page_stats_as_text); + + /* grab main structure */ + pagestats->totalpages = (unsigned long) text_to_double(strtok((char *)NULL, "\t")); + + pagestats->page_size = (unsigned int) text_to_double(strtok((char *)NULL, "\t")); + + pagestats->page_valid = (int) text_to_double(strtok((char *)NULL, "\t")); + + pagestats->rs = *the_rqst_stats; + /* return bytes read */ + + return(pagestats); +} /* end text_to_page_stats */ + + + +char * +page_stats_to_text(const page_stats_t *pagestats) { + THREAD static char page_stats_as_text[SIZEOF_PAGESTATSTEXT]; + char *tmpbuf; + rqst_stats_t the_rqst_stats; + + *page_stats_as_text = 0; + + /* stats.rs */ + the_rqst_stats = pagestats->rs; + tmpbuf = rqst_stats_to_text(&the_rqst_stats); + strcat(page_stats_as_text, tmpbuf); + + /* main structure */ + tmpbuf = double_to_text(pagestats->totalpages); + strcat(page_stats_as_text, tmpbuf); + + tmpbuf = double_to_text(pagestats->page_size); + strcat(page_stats_as_text, tmpbuf); + + tmpbuf = double_to_text(pagestats->page_valid); + strcat(page_stats_as_text, tmpbuf); + + strcat(page_stats_as_text, "\n"); + + return(page_stats_as_text); +} /* end page_stats_to_text */ + +void +rqtimer_init(rqst_timer_t *p) { + memset(p, 0, sizeof(*p)); +} + +void +rqstat_init(rqst_stats_t *p) { + memset(p, 0, sizeof(*p)); + + p->minbytes = DBL_MAX; + p->minbody = DBL_MAX; + p->minconnecttime.tv_sec = LONG_MAX; + p->minconnecttime.tv_usec = LONG_MAX; + p->minresponsetime.tv_sec = LONG_MAX; + p->minresponsetime.tv_usec = LONG_MAX; +} + +void +stats_init(stats_t *p) { + + memset(p, 0, sizeof(*p)); + + p->rs.minbytes = DBL_MAX; + p->rs.minbody = DBL_MAX; + p->rs.minconnecttime.tv_sec = LONG_MAX; + p->rs.minconnecttime.tv_usec = LONG_MAX; + p->rs.minresponsetime.tv_sec = LONG_MAX; + p->rs.minresponsetime.tv_usec = LONG_MAX; +} + +void +page_stats_init(page_stats_t *p) { + + memset(p, 0, sizeof(*p)); + + /* commented out so that unread pages result in + page_stats_as_text buffer overflow + p->rs.minbytes = DBL_MAX; + p->rs.minbody = DBL_MAX; + p->rs.minconnecttime.tv_sec = LONG_MAX; + p->rs.minconnecttime.tv_usec = LONG_MAX; + p->rs.minresponsetime.tv_sec = LONG_MAX; + p->rs.minresponsetime.tv_usec = LONG_MAX; + + */ +} + +void +rqstat_times(rqst_stats_t *rs, rqst_timer_t *rt) +{ + double t; + + compdifftime(&(rt->exittime), &(rt->entertime), + &(rs->totalresponsetime)); + t = timevaldouble(&(rs->totalresponsetime)); + rs->totalresponsetimesq = t * t; + + rs->minresponsetime = rs->totalresponsetime; + rs->maxresponsetime = rs->totalresponsetime; + + compdifftime(&(rt->afterconnect), &(rt->beforeconnect), + &(rs->totalconnecttime)); + + t = timevaldouble(&(rs->totalconnecttime)); + rs->totalconnecttimesq = t * t; + + rs->minconnecttime = rs->totalconnecttime; + rs->maxconnecttime = rs->totalconnecttime; + + rs->totalbody = rt->bodybytes; + rs->totalbodysq = ((double)(rt->bodybytes)) * ((double)(rt->bodybytes)); + rs->minbody = rt->bodybytes; + rs->maxbody = rt->bodybytes; + + rs->totalbytes = rt->totalbytes; + rs->totalbytessq = ((double)(rt->totalbytes)) * ((double)(rt->totalbytes)); + rs->minbytes = rt->totalbytes; + rs->maxbytes = rt->totalbytes; + + rs->totalconnects = 1; + rs->totalerrs = 0; + rs->totalerrortime.tv_sec = 0; + rs->totalerrortime.tv_usec = 0; +} + +void +rqstat_sum(rqst_stats_t *sum, rqst_stats_t *incr) +{ + addtime( &(sum->totalresponsetime), &(incr->totalresponsetime)); + mintime( &(sum->minresponsetime), &(incr->minresponsetime)); + maxtime( &(sum->maxresponsetime), &(incr->maxresponsetime)); + sum->totalresponsetimesq += incr->totalresponsetimesq; + + addtime( &(sum->totalconnecttime), &(incr->totalconnecttime)); + mintime( &(sum->minconnecttime), &(incr->minconnecttime)); + maxtime( &(sum->maxconnecttime), &(incr->maxconnecttime)); + sum->totalconnecttimesq += incr->totalconnecttimesq; + + sum->totalconnects += incr->totalconnects; + sum->totalerrs += incr->totalerrs; + addtime( &(sum->totalerrortime), &(incr->totalerrortime)); + + sum->totalbytes += incr->totalbytes; + + sum->totalbytessq += incr->totalbytessq; + sum->minbytes = min(sum->minbytes, incr->minbytes); + sum->maxbytes = max(sum->maxbytes, incr->maxbytes); + + sum->totalbody += incr->totalbody; + + sum->totalbodysq += incr->totalbodysq; + sum->minbody = min(sum->minbody, incr->minbody); + sum->maxbody = max(sum->maxbody, incr->maxbody); + +} + + +void +rqstat_print(rqst_stats_t *stats) +{ + rqstat_fprint(stdout, stats); +} + + +void +rqstat_fprint(FILE *f, rqst_stats_t *stats) +{ + struct timeval meantime, /*vartime,*/ stdtime; + + fprintf(f, "%d connection(s) to server, %d errors\n", + stats->totalconnects, stats->totalerrs); + + if (stats->totalconnects == 0) { + fprintf(f,"NO CONNECTIONS, THEREFORE NO STATISTICS\n" + "IS YOUR WEBSERVER RUNNING?\n" + "DO THE PAGES EXIST ON THE SERVER?\n"); + return; + } + + /* title */ + fprintf(f, "\n\t\t\t Average Std Dev Minimum Maximum\n\n"); + + /* first line (connect time) */ + avgtime(&(stats->totalconnecttime), + stats->totalconnects, &meantime); + + /* variancetime(&(stats->totalconnecttime), + stats->totalconnecttimesq, + stats->totalconnects, &vartime); */ + + stddevtime(&(stats->totalconnecttime), + stats->totalconnecttimesq, + stats->totalconnects, &stdtime); + + fprintf(f, "Connect time (sec) \t%3d.%6.6d %3d.%6.6d %3d.%6.6d %3d.%6.6d\n", + meantime.tv_sec, + meantime.tv_usec, + stdtime.tv_sec, + stdtime.tv_usec, + stats->minconnecttime.tv_sec, + stats->minconnecttime.tv_usec, + stats->maxconnecttime.tv_sec, + stats->maxconnecttime.tv_usec); + + /* second line (response time) */ + avgtime(&(stats->totalresponsetime), + stats->totalconnects, &meantime); + + /* variancetime(&(stats->totalresponsetime), + stats->totalresponsetimesq, + stats->totalconnects, &vartime); */ + + stddevtime(&(stats->totalresponsetime), + stats->totalresponsetimesq, + stats->totalconnects, &stdtime); + + fprintf(f, "Response time (sec) \t%3d.%6.6d %3d.%6.6d %3d.%6.6d %3d.%6.6d\n", + meantime.tv_sec, + meantime.tv_usec, + stdtime.tv_sec, + stdtime.tv_usec, + stats->minresponsetime.tv_sec, + stats->minresponsetime.tv_usec, + stats->maxresponsetime.tv_sec, + stats->maxresponsetime.tv_usec); + + /* 3rd-5th lines (response size, body size, # bytes moved */ + fprintf(f, "Response size (bytes) \t%10.0lf %10.0lf %10.0lf %10.0lf\n", + mean(stats->totalbytes, stats->totalconnects), + stddev(stats->totalbytes, stats->totalbytessq, + stats->totalconnects), + stats->minbytes, + stats->maxbytes); + + fprintf(f, "Body size (bytes) \t%10.0lf %10.0lf %10.0lf %10.0lf\n\n", + mean(stats->totalbody, stats->totalconnects), + stddev(stats->totalbody, stats->totalbodysq, + stats->totalconnects), + stats->minbody, + stats->maxbody); + + fprintf(f, "%.0lf body bytes moved + %.0lf header bytes moved = %.0lf total\n", + stats->totalbody, + stats->totalbytes - stats->totalbody, + stats->totalbytes); + +} diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/bench.h b/ACE/apps/JAWS/clients/WebSTONE/src/bench.h new file mode 100644 index 00000000000..489b6596efc --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/bench.h @@ -0,0 +1,274 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ +#ifndef __BENCH_H__ +#define __BENCH_H__ +#include <stdio.h> +#include <stdarg.h> +#ifndef WIN32 +#include <sys/time.h> +#endif /* WIN32 */ + +#define USECINSEC 1000000 +#define MSECINSEC 1000 +#define MAX_ACCEPT_SECS 180 /* maximum time master will wait for listen() */ + +#define NCCARGS 4096 +#define MAXCLIENTS 1024 +#define MAXUSERNAME 25 +#define MAXPASSWD 20 +#define BUFSIZE 4096 + +#define MAXTOTALPROCS MAXCLIENTS /* overall max # of procs */ +#define MAXPROCSPERNODE MAXCLIENTS /* max # of procs/node */ + + +#define CONTENT_LENGTH_STRING "CONTENT-LENGTH:" +#define OKSTR "OK" +#define OKSTRLEN ((int)strlen(OKSTR)) +#define GOSTR "GO" +#define GOSTRLEN ((int)strlen(GOSTR)) +#define READYSTR "READY" +#define READYSTRLEN ((int)strlen(READYSTR)) +#define ABORTSTR "ABORT" +#define ABORTSTRLEN ((int)strlen(ABORTSTR)) + + +#define MAXNUMOFFILES 1 /* max # of files per page */ +#define URL_SIZE 1024 +#define MAXNUMOFPAGES 100 +#define SIZEOF_TIMEVALTEXT 18 +#define SIZEOF_DOUBLETEXT 18 +#define SIZEOF_RQSTSTATSTEXT ((7 * SIZEOF_TIMEVALTEXT) + \ + (12 * SIZEOF_DOUBLETEXT) + 1) +#define SIZEOF_STATSTEXTBASE (SIZEOF_RQSTSTATSTEXT + \ + (3 * SIZEOF_TIMEVALTEXT) + \ + (2 * SIZEOF_DOUBLETEXT) + 1) +#define SIZEOF_STATSTEXT (SIZEOF_STATSTEXTBASE + MAXNUMOFPAGES * SIZEOF_DOUBLETEXT) +#define SIZEOF_PAGESTATSTEXT (SIZEOF_RQSTSTATSTEXT + \ + (0 * SIZEOF_TIMEVALTEXT) + \ + (3 * SIZEOF_DOUBLETEXT) + 1) + +#define D_PRINTF debug && d_printf + +#ifdef USE_TIMEZONE +typedef struct rqst_timer { + struct timeval entertime; + struct timezone entertimezone; + struct timeval beforeconnect; + struct timezone beforeconnectzone; + struct timeval afterconnect; + struct timezone afterconnectzone; + struct timeval beforeheader; + struct timezone beforeheaderzone; + struct timeval afterheader; + struct timezone afterheaderzone; + struct timeval afterbody; + struct timezone afterbodyzone; + struct timeval exittime; + struct timezone exittimezone; + long unsigned int totalbytes; + long unsigned int bodybytes; + int valid; + long unsigned int page_number; +} rqst_timer_t; +#else +typedef struct rqst_timer { + struct timeval entertime; + struct timeval beforeconnect; + struct timeval afterconnect; + struct timeval beforeheader; + struct timeval afterheader; + struct timeval afterbody; + struct timeval exittime; + long unsigned int totalbytes; + long unsigned int bodybytes; + int valid; + long unsigned int page_number; +} rqst_timer_t; +#endif /* USE_TIMEZONE */ + +extern void rqtimer_init(rqst_timer_t *); + +#ifdef USE_TIMEZONE +typedef struct rqst_stats { + struct timeval totalresponsetime; + struct timezone totalresponsetimezone; + double totalresponsetimesq; + struct timeval minresponsetime; + struct timezone minresponsetimezone; + struct timeval maxresponsetime; + struct timezone maxresponsetimezone; + struct timeval totalconnecttime; + struct timezone totalconnecttimezone; + double totalconnecttimesq; + struct timeval minconnecttime; + struct timezone minconnecttimezone; + struct timeval maxconnecttime; + struct timezone maxconnecttimezone; + long unsigned int totalconnects; + long unsigned int totalerrs; + struct timeval totalerrortime; + struct timezone totalerrortimezone; + double totalbytes; + double totalbytessq; + double minbytes; + double maxbytes; + double totalbody; + double totalbodysq; + double minbody; + double maxbody; +} rqst_stats_t; +#else +typedef struct rqst_stats { + struct timeval totalresponsetime; + double totalresponsetimesq; + struct timeval minresponsetime; + struct timeval maxresponsetime; + struct timeval totalconnecttime; + double totalconnecttimesq; + struct timeval minconnecttime; + struct timeval maxconnecttime; + long unsigned int totalconnects; + long unsigned int totalerrs; + struct timeval totalerrortime; + double totalbytes; + double totalbytessq; + double minbytes; + double maxbytes; + double totalbody; + double totalbodysq; + double minbody; + double maxbody; +} rqst_stats_t; +#endif /* USE_TIMEZONE */ + +extern void rqstat_init(rqst_stats_t *); +extern void rqstat_sum(rqst_stats_t *, rqst_stats_t *); +extern void rqstat_print(rqst_stats_t *); +extern void rqstat_fprint(FILE *, rqst_stats_t *); +extern void rqstat_times(rqst_stats_t *, rqst_timer_t *); + +#ifdef USE_TIMEZONE +typedef struct stats { + /* char hostname[MAXHOSTNAMELEN]; */ + rqst_stats_t rs; + struct timeval starttime; + struct timezone starttimezone; + struct timeval endtime; + struct timezone endtimezone; + struct timeval datatime; + struct timezone datatimezone; + long unsigned int totalpages; + unsigned int total_num_of_files; + unsigned int page_numbers[MAXNUMOFPAGES]; +} stats_t; +#else +typedef struct stats { + /* char hostname[MAXHOSTNAMELEN]; */ + rqst_stats_t rs; + struct timeval starttime; + struct timeval endtime; + struct timeval datatime; + long unsigned int totalpages; + unsigned int total_num_of_files; + unsigned int page_numbers[MAXNUMOFPAGES]; +} stats_t; +#endif /* USE_TIMEZONE */ + +extern void stats_init(stats_t *); +extern stats_t * text_to_stats(char *); +extern char * stats_to_text(const stats_t *); + +typedef struct page_stats { + rqst_stats_t rs; + long unsigned int totalpages; + unsigned int page_size; + int page_valid; +} page_stats_t; + +extern void page_stats_init(page_stats_t *); +extern page_stats_t * text_to_page_stats(char *); +extern char * page_stats_to_text(const page_stats_t *); + +/* THIS STRUCTURE DEFINES A PAGE. */ +typedef struct page_list { + int load_num; + int num_of_files; + char *(filename[MAXNUMOFFILES]); + char *(servername[MAXNUMOFFILES]); + int port_number[MAXNUMOFFILES]; +}page_list_t; + + + +/* shared variables */ +extern THREAD FILE *debugfile; +extern int debug; + +extern int savefile; +extern int timeexpired; +extern long int number_of_pages; + +/* routines in bench.c */ + +extern void *mymalloc(size_t size); +extern int recvdata(SOCKET sock, char *ptr, int nbytes); +extern int senddata(SOCKET sock, char *ptr, int nbytes); +extern void rqstat_times(rqst_stats_t *rs, rqst_timer_t *rt); +/* note several others listed above */ + +/* routines in errexit.c */ + +void errexit(const char *, ...); +extern int returnerr(const char *, ...); +extern int d_printf(const char *, ...); +extern char *neterrstr(void); + +/* routines in get.c */ + +extern int get(char *loc, NETPORT port, char *url, rqst_timer_t *timer); + +/* routines in parse_file_list.c */ + +extern int count_file_list(const char *url_list_file); +extern void parse_file_list (const char *url_list_file, page_list_t *page_list, + long int *num_of_pages, long int *num_of_files); +extern long int load_percent(page_list_t *page_list, long int number_of_pages); + +/* routines in statistics.c (formerly statistics.h) */ + +extern double mean(const double, const int); +extern double variance(const double, const double, const int); +extern double stddev(const double, const double, const int); + +/* routines in timefunc.c (formerly timefunc.h) */ + +extern double timevaldouble(struct timeval *); +extern void doubletimeval(const double, struct timeval *); + +extern void addtime(struct timeval *, struct timeval *); +extern void compdifftime(struct timeval *, struct timeval *, struct timeval *); +extern void mintime(struct timeval *, struct timeval *); +extern void maxtime(struct timeval *, struct timeval *); +extern void avgtime(struct timeval *, int, struct timeval *); +extern void variancetime(struct timeval *, double, int, struct timeval *); +extern void stddevtime(struct timeval *, double, int, struct timeval *); + +extern void sqtime(struct timeval *, struct timeval *); + +extern double thruputpersec(const double, struct timeval *); + +/* routines in webclient.c */ + +extern SOCKET connectsock(char *host, NETPORT portnum, char *protocol); + +#endif /* !__BENCH_H__ */ diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/cgi-send.c b/ACE/apps/JAWS/clients/WebSTONE/src/cgi-send.c new file mode 100644 index 00000000000..0a63070b7b7 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/cgi-send.c @@ -0,0 +1,46 @@ +/* $Id$ */ +/* + * Send 10K file; send random bits. + * + */ + +#include <stdio.h> +#include <stdlib.h> + +#define FILE_SIZE 10240 +#define MALLOC_FAILURE "Out of memory" + +int +main() +{ + int filesize; + char *str_filesize; + char *buffer; + int index; + + printf("Content-type: text/plain\r\n\r\n"); + + if ( !(str_filesize = getenv("QUERY_STRING")) ) + filesize = FILE_SIZE; + else { + if ( !strncmp(str_filesize, "size=", 5) ) + filesize = atoi(&(str_filesize[5])); + else + filesize = FILE_SIZE; + } + + if ( !(buffer = (char *)malloc(filesize)) ) { + fwrite(MALLOC_FAILURE, strlen(MALLOC_FAILURE), 1, stdout); + return -1; + } + + for (index=0; index< filesize; index++) + /* generate random characters from A-Z */ + buffer[index] = rand() %26 + 63; + + fwrite(buffer, filesize, 1, stdout); + + free(buffer); + + return 0; +} diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/config.cache b/ACE/apps/JAWS/clients/WebSTONE/src/config.cache new file mode 100644 index 00000000000..c8705dca2f4 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/config.cache @@ -0,0 +1,47 @@ +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +ac_cv_c_const=${ac_cv_c_const='yes'} +ac_cv_c_cross=${ac_cv_c_cross='no'} +ac_cv_func_gethostname=${ac_cv_func_gethostname='yes'} +ac_cv_func_gettimeofday=${ac_cv_func_gettimeofday='yes'} +ac_cv_func_memcmp=${ac_cv_func_memcmp='yes'} +ac_cv_func_select=${ac_cv_func_select='yes'} +ac_cv_func_socket=${ac_cv_func_socket='yes'} +ac_cv_func_strerror=${ac_cv_func_strerror='yes'} +ac_cv_func_vprintf=${ac_cv_func_vprintf='yes'} +ac_cv_func_wait3=${ac_cv_func_wait3='yes'} +ac_cv_header_fcntl_h=${ac_cv_header_fcntl_h='yes'} +ac_cv_header_limits_h=${ac_cv_header_limits_h='yes'} +ac_cv_header_sgtty_h=${ac_cv_header_sgtty_h='yes'} +ac_cv_header_stdc=${ac_cv_header_stdc='yes'} +ac_cv_header_sys_time_h=${ac_cv_header_sys_time_h='yes'} +ac_cv_header_sys_wait_h=${ac_cv_header_sys_wait_h='yes'} +ac_cv_header_time=${ac_cv_header_time='yes'} +ac_cv_header_unistd_h=${ac_cv_header_unistd_h='yes'} +ac_cv_lib_compat=${ac_cv_lib_compat='no'} +ac_cv_lib_m=${ac_cv_lib_m='yes'} +ac_cv_lib_socket=${ac_cv_lib_socket='yes'} +ac_cv_lib_ucb=${ac_cv_lib_ucb='no'} +ac_cv_path_PERL=${ac_cv_path_PERL='/usr/sbin/perl'} +ac_cv_prog_AWK=${ac_cv_prog_AWK='nawk'} +ac_cv_prog_CC=${ac_cv_prog_CC='cc'} +ac_cv_prog_CPP=${ac_cv_prog_CPP='cc -E'} +ac_cv_prog_gcc=${ac_cv_prog_gcc='no'} +ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'} +ac_cv_struct_tm=${ac_cv_struct_tm='time.h'} +ac_cv_struct_tm_zone=${ac_cv_struct_tm_zone='no'} +ac_cv_type_signal=${ac_cv_type_signal='void'} +ac_cv_type_size_t=${ac_cv_type_size_t='yes'} +ac_cv_var_tzname=${ac_cv_var_tzname='yes'} diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/config.guess b/ACE/apps/JAWS/clients/WebSTONE/src/config.guess new file mode 100755 index 00000000000..2ff0eba28ac --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/config.guess @@ -0,0 +1,565 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner <bothner@cygnus.com>. +# The master version of this file is at the FSF in /home/gd/gnu/lib. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + alpha:OSF1:V*:*) + # After 1.2, OSF1 uses "V1.3" for uname -r. + echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'` + exit 0 ;; + alpha:OSF1:*:*) + # 1.2 uses "1.2" for uname -r. + echo alpha-dec-osf${UNAME_RELEASE} + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + amiga:NetBSD:*:*) + echo m68k-cbm-netbsd${UNAME_RELEASE} + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + Pyramid*:OSx*:*:*) + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + sun4*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:NetBSD:*:*) + echo m68k-atari-netbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:NetBSD:*:*) + echo m68k-sun-netbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:NetBSD:*:*) + echo m68k-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + mips:*:4*:UMIPS) + echo mips-mips-riscos4sysv + exit 0 ;; + mips:*:5*:RISCos) + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ + -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i[34]86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[3478]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/7?? | 9000/8?[79] ) HP_ARCH=hppa1.1 ;; + 9000/8?? ) HP_ARCH=hppa1.0 ;; + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*C90:*:*:*) + echo c90-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + i[34]86:BSD/386:*:* | *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. + ld_help_string=`ld --help 2>&1` + if echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then + echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 + elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then + echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0 + elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then + echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0 + elif test "${UNAME_MACHINE}" = "alpha" ; then + echo alpha-unknown-linux ; exit 0 + else + # Either a pre-BFD a.out linker (linuxoldld) or one that does not give us + # useful --help. Gcc wants to distinguish between linuxoldld and linuxaout. + test ! -d /usr/lib/ldscripts/. \ + && echo "${UNAME_MACHINE}-unknown-linuxoldld" && exit 0 + # Determine whether the default compiler is a.out or elf + cat >dummy.c <<EOF +main(argc, argv) +int argc; +char *argv[]; +{ +#ifdef __ELF__ + printf ("%s-unknown-linux\n", argv[1]); +#else + printf ("%s-unknown-linuxaout\n", argv[1]); +#endif + return 0; +} +EOF + ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + fi ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i[34]86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + else + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i[34]86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-unknown-sysv32 + fi + exit 0 ;; + Intel:Mach:3*:*) + echo i386-unknown-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M680[234]0:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0) + uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3 && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m680[234]0:LynxOS:2.[23]*:*) + echo m68k-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i[34]86:LynxOS:2.[23]*:*) + echo i386-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.[23]*:*) + echo sparc-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.[23]*:*) + echo rs6000-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3"); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-unknown-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/config.h b/ACE/apps/JAWS/clients/WebSTONE/src/config.h new file mode 100644 index 00000000000..782ba57a71b --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/config.h @@ -0,0 +1,91 @@ +/* $Id$ */ +/* config.h. Generated automatically by configure. */ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define if you don't have vprintf but do have _doprnt. */ +/* #undef HAVE_DOPRNT */ + +/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define if your struct tm has tm_zone. */ +/* #undef HAVE_TM_ZONE */ + +/* Define if you don't have tm_zone but do have the external array + tzname. */ +#define HAVE_TZNAME 1 + +/* Define if you have the vprintf function. */ +#define HAVE_VPRINTF 1 + +/* Define if you have the wait3 system call. */ +#define HAVE_WAIT3 1 + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define to `unsigned' if <sys/types.h> doesn't define. */ +/* #undef size_t */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if your <sys/time.h> declares struct tm. */ +/* #undef TM_IN_SYS_TIME */ + +/* Define to the name of the distribution. */ +#define PRODUCT "webstone" + +/* Define to the version of the distribution. */ +#define VERSION "2.0b4" + +/* Should we use timezone in gettimeofday? */ +#define USE_TIMEZONE 1 + +/* Define if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define if you have the gettimeofday function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define if you have the select function. */ +#define HAVE_SELECT 1 + +/* Define if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define if you have the strerror function. */ +#define HAVE_STRERROR 1 + +/* Define if you have the <fcntl.h> header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the <limits.h> header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you have the <sgtty.h> header file. */ +#define HAVE_SGTTY_H 1 + +/* Define if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the compat library (-lcompat). */ +/* #undef HAVE_LIBCOMPAT */ + +/* Define if you have the m library (-lm). */ +#define HAVE_LIBM 1 + +/* Define if you have the socket library (-lsocket). */ +#define HAVE_LIBSOCKET 1 + +/* Define if you have the ucb library (-lucb). */ +/* #undef HAVE_LIBUCB */ diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/config.h.in b/ACE/apps/JAWS/clients/WebSTONE/src/config.h.in new file mode 100644 index 00000000000..91299ae624b --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/config.h.in @@ -0,0 +1,89 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define if you don't have vprintf but do have _doprnt. */ +#undef HAVE_DOPRNT + +/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define if your struct tm has tm_zone. */ +#undef HAVE_TM_ZONE + +/* Define if you don't have tm_zone but do have the external array + tzname. */ +#undef HAVE_TZNAME + +/* Define if you have the vprintf function. */ +#undef HAVE_VPRINTF + +/* Define if you have the wait3 system call. */ +#undef HAVE_WAIT3 + +/* Define as the return type of signal handlers (int or void). */ +#undef RETSIGTYPE + +/* Define to `unsigned' if <sys/types.h> doesn't define. */ +#undef size_t + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* Define if your <sys/time.h> declares struct tm. */ +#undef TM_IN_SYS_TIME + +/* Define to the name of the distribution. */ +#undef PRODUCT + +/* Define to the version of the distribution. */ +#undef VERSION + +/* Should we use timezone in gettimeofday? */ +#undef USE_TIMEZONE + +/* Define if you have the gethostname function. */ +#undef HAVE_GETHOSTNAME + +/* Define if you have the gettimeofday function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define if you have the select function. */ +#undef HAVE_SELECT + +/* Define if you have the socket function. */ +#undef HAVE_SOCKET + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR + +/* Define if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define if you have the <limits.h> header file. */ +#undef HAVE_LIMITS_H + +/* Define if you have the <sgtty.h> header file. */ +#undef HAVE_SGTTY_H + +/* Define if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the compat library (-lcompat). */ +#undef HAVE_LIBCOMPAT + +/* Define if you have the m library (-lm). */ +#undef HAVE_LIBM + +/* Define if you have the socket library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you have the ucb library (-lucb). */ +#undef HAVE_LIBUCB diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/config.log b/ACE/apps/JAWS/clients/WebSTONE/src/config.log new file mode 100644 index 00000000000..1b2fa65abd8 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/config.log @@ -0,0 +1,4 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +cc -c -g conftest.c diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/config.status b/ACE/apps/JAWS/clients/WebSTONE/src/config.status new file mode 100755 index 00000000000..2f00f63aba7 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/config.status @@ -0,0 +1,288 @@ +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host tango: +# +# configure +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]" +for ac_option +do + case "$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running ${CONFIG_SHELL-/bin/sh} configure --no-create --no-recursion" + exec ${CONFIG_SHELL-/bin/sh} configure --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "./config.status generated by autoconf version 2.7" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "$ac_cs_usage"; exit 0 ;; + *) echo "$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=. + +trap 'rm -fr Makefile config.h conftest*; exit 1' 1 2 15 + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; + s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +/^[ ]*VPATH[ ]*=[^:]*$/d + +s%@CFLAGS@%-g%g +s%@CPPFLAGS@%%g +s%@CXXFLAGS@%%g +s%@DEFS@%-DHAVE_CONFIG_H%g +s%@LDFLAGS@%%g +s%@LIBS@%-lsocket -lm %g +s%@exec_prefix@%${prefix}%g +s%@prefix@%bin%g +s%@program_transform_name@%s,x,x,%g +s%@bindir@%${exec_prefix}/bin%g +s%@sbindir@%${exec_prefix}/sbin%g +s%@libexecdir@%${exec_prefix}/libexec%g +s%@datadir@%${prefix}/share%g +s%@sysconfdir@%${prefix}/etc%g +s%@sharedstatedir@%${prefix}/com%g +s%@localstatedir@%${prefix}/var%g +s%@libdir@%${exec_prefix}/lib%g +s%@includedir@%${prefix}/include%g +s%@oldincludedir@%/usr/include%g +s%@infodir@%${prefix}/info%g +s%@mandir@%${prefix}/man%g +s%@PRODUCT@%webstone%g +s%@VERSION@%2.0b4%g +s%@host@%sparc-sun-solaris2.5.1%g +s%@host_alias@%sparc-sun-solaris2.5.1%g +s%@host_cpu@%sparc%g +s%@host_vendor@%sun%g +s%@host_os@%solaris2.5.1%g +s%@target@%sparc-sun-solaris2.5.1%g +s%@target_alias@%sparc-sun-solaris2.5.1%g +s%@target_cpu@%sparc%g +s%@target_vendor@%sun%g +s%@target_os@%solaris2.5.1%g +s%@build@%sparc-sun-solaris2.5.1%g +s%@build_alias@%sparc-sun-solaris2.5.1%g +s%@build_cpu@%sparc%g +s%@build_vendor@%sun%g +s%@build_os@%solaris2.5.1%g +s%@CC@%cc%g +s%@SET_MAKE@%%g +s%@AWK@%nawk%g +s%@PERL@%/usr/sbin/perl%g +s%@PERL_SCRIPTS@%bin/wscollect.pl%g +s%@CPP@%cc -E%g +s%@LIBOBJS@%%g + +CEOF + +CONFIG_FILES=${CONFIG_FILES-"Makefile"} +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust relative srcdir, etc. for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +fi; done +rm -f conftest.subs + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +CONFIG_HEADERS=${CONFIG_HEADERS-"config.h"} +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + cp $ac_given_srcdir/$ac_file_in conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}PRODUCT${ac_dB}PRODUCT${ac_dC}"webstone"${ac_dD} +${ac_uA}PRODUCT${ac_uB}PRODUCT${ac_uC}"webstone"${ac_uD} +${ac_eA}PRODUCT${ac_eB}PRODUCT${ac_eC}"webstone"${ac_eD} +${ac_dA}VERSION${ac_dB}VERSION${ac_dC}"2.0b4"${ac_dD} +${ac_uA}VERSION${ac_uB}VERSION${ac_uC}"2.0b4"${ac_uD} +${ac_eA}VERSION${ac_eB}VERSION${ac_eC}"2.0b4"${ac_eD} +${ac_dA}HAVE_LIBM${ac_dB}HAVE_LIBM${ac_dC}1${ac_dD} +${ac_uA}HAVE_LIBM${ac_uB}HAVE_LIBM${ac_uC}1${ac_uD} +${ac_eA}HAVE_LIBM${ac_eB}HAVE_LIBM${ac_eC}1${ac_eD} +${ac_dA}HAVE_LIBSOCKET${ac_dB}HAVE_LIBSOCKET${ac_dC}1${ac_dD} +${ac_uA}HAVE_LIBSOCKET${ac_uB}HAVE_LIBSOCKET${ac_uC}1${ac_uD} +${ac_eA}HAVE_LIBSOCKET${ac_eB}HAVE_LIBSOCKET${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}STDC_HEADERS${ac_dB}STDC_HEADERS${ac_dC}1${ac_dD} +${ac_uA}STDC_HEADERS${ac_uB}STDC_HEADERS${ac_uC}1${ac_uD} +${ac_eA}STDC_HEADERS${ac_eB}STDC_HEADERS${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_WAIT_H${ac_dB}HAVE_SYS_WAIT_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_WAIT_H${ac_uB}HAVE_SYS_WAIT_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_WAIT_H${ac_eB}HAVE_SYS_WAIT_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_FCNTL_H${ac_dB}HAVE_FCNTL_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_FCNTL_H${ac_uB}HAVE_FCNTL_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_FCNTL_H${ac_eB}HAVE_FCNTL_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_LIMITS_H${ac_dB}HAVE_LIMITS_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_LIMITS_H${ac_uB}HAVE_LIMITS_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_LIMITS_H${ac_eB}HAVE_LIMITS_H${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SGTTY_H${ac_dB}HAVE_SGTTY_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SGTTY_H${ac_uB}HAVE_SGTTY_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SGTTY_H${ac_eB}HAVE_SGTTY_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_TIME_H${ac_dB}HAVE_SYS_TIME_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_TIME_H${ac_uB}HAVE_SYS_TIME_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_TIME_H${ac_eB}HAVE_SYS_TIME_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_UNISTD_H${ac_dB}HAVE_UNISTD_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_UNISTD_H${ac_uB}HAVE_UNISTD_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_UNISTD_H${ac_eB}HAVE_UNISTD_H${ac_eC}1${ac_eD} +${ac_dA}RETSIGTYPE${ac_dB}RETSIGTYPE${ac_dC}void${ac_dD} +${ac_uA}RETSIGTYPE${ac_uB}RETSIGTYPE${ac_uC}void${ac_uD} +${ac_eA}RETSIGTYPE${ac_eB}RETSIGTYPE${ac_eC}void${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}TIME_WITH_SYS_TIME${ac_dB}TIME_WITH_SYS_TIME${ac_dC}1${ac_dD} +${ac_uA}TIME_WITH_SYS_TIME${ac_uB}TIME_WITH_SYS_TIME${ac_uC}1${ac_uD} +${ac_eA}TIME_WITH_SYS_TIME${ac_eB}TIME_WITH_SYS_TIME${ac_eC}1${ac_eD} +${ac_dA}HAVE_TZNAME${ac_dB}HAVE_TZNAME${ac_dC}1${ac_dD} +${ac_uA}HAVE_TZNAME${ac_uB}HAVE_TZNAME${ac_uC}1${ac_uD} +${ac_eA}HAVE_TZNAME${ac_eB}HAVE_TZNAME${ac_eC}1${ac_eD} +${ac_dA}USE_TIMEZONE${ac_dB}USE_TIMEZONE${ac_dC}1${ac_dD} +${ac_uA}USE_TIMEZONE${ac_uB}USE_TIMEZONE${ac_uC}1${ac_uD} +${ac_eA}USE_TIMEZONE${ac_eB}USE_TIMEZONE${ac_eC}1${ac_eD} +${ac_dA}RETSIGTYPE${ac_dB}RETSIGTYPE${ac_dC}void${ac_dD} +${ac_uA}RETSIGTYPE${ac_uB}RETSIGTYPE${ac_uC}void${ac_uD} +${ac_eA}RETSIGTYPE${ac_eB}RETSIGTYPE${ac_eC}void${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_VPRINTF${ac_dB}HAVE_VPRINTF${ac_dC}1${ac_dD} +${ac_uA}HAVE_VPRINTF${ac_uB}HAVE_VPRINTF${ac_uC}1${ac_uD} +${ac_eA}HAVE_VPRINTF${ac_eB}HAVE_VPRINTF${ac_eC}1${ac_eD} +${ac_dA}HAVE_WAIT3${ac_dB}HAVE_WAIT3${ac_dC}1${ac_dD} +${ac_uA}HAVE_WAIT3${ac_uB}HAVE_WAIT3${ac_uC}1${ac_uD} +${ac_eA}HAVE_WAIT3${ac_eB}HAVE_WAIT3${ac_eC}1${ac_eD} +${ac_dA}HAVE_GETHOSTNAME${ac_dB}HAVE_GETHOSTNAME${ac_dC}1${ac_dD} +${ac_uA}HAVE_GETHOSTNAME${ac_uB}HAVE_GETHOSTNAME${ac_uC}1${ac_uD} +${ac_eA}HAVE_GETHOSTNAME${ac_eB}HAVE_GETHOSTNAME${ac_eC}1${ac_eD} +${ac_dA}HAVE_GETTIMEOFDAY${ac_dB}HAVE_GETTIMEOFDAY${ac_dC}1${ac_dD} +${ac_uA}HAVE_GETTIMEOFDAY${ac_uB}HAVE_GETTIMEOFDAY${ac_uC}1${ac_uD} +${ac_eA}HAVE_GETTIMEOFDAY${ac_eB}HAVE_GETTIMEOFDAY${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SELECT${ac_dB}HAVE_SELECT${ac_dC}1${ac_dD} +${ac_uA}HAVE_SELECT${ac_uB}HAVE_SELECT${ac_uC}1${ac_uD} +${ac_eA}HAVE_SELECT${ac_eB}HAVE_SELECT${ac_eC}1${ac_eD} +${ac_dA}HAVE_SOCKET${ac_dB}HAVE_SOCKET${ac_dC}1${ac_dD} +${ac_uA}HAVE_SOCKET${ac_uB}HAVE_SOCKET${ac_uC}1${ac_uD} +${ac_eA}HAVE_SOCKET${ac_eB}HAVE_SOCKET${ac_eC}1${ac_eD} +${ac_dA}HAVE_STRERROR${ac_dB}HAVE_STRERROR${ac_dC}1${ac_dD} +${ac_uA}HAVE_STRERROR${ac_uB}HAVE_STRERROR${ac_uC}1${ac_uD} +${ac_eA}HAVE_STRERROR${ac_eB}HAVE_STRERROR${ac_eC}1${ac_eD} +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + + + +exit 0 diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/config.sub b/ACE/apps/JAWS/clients/WebSTONE/src/config.sub new file mode 100755 index 00000000000..e67a800b515 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/config.sub @@ -0,0 +1,867 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS (if any). +basic_machine=`echo $1 | sed 's/-[^-]*$//'` +if [ $basic_machine != $1 ] +then os=`echo $1 | sed 's/.*-/-/'` +else os=; fi + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp ) + os= + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i[345]86 | i860 | m68k | m68000 | m88k | ns32k | arm \ + | arme[lb] | pyramid \ + | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \ + | alpha | we32k | ns16k | clipper | sparclite | i370 | sh \ + | powerpc | powerpcle | sparc64 | 1750a | dsp16xx | mips64 | mipsel \ + | pdp11 | mips64el | mips64orion | mips64orionel \ + | sparc) + basic_machine=$basic_machine-unknown + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + vax-* | tahoe-* | i[345]86-* | i860-* | m68k-* | m68000-* | m88k-* \ + | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \ + | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \ + | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \ + | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \ + | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigados) + basic_machine=m68k-cbm + os=-amigados + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + os=-mvs + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[345]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + os=-sysv32 + ;; + i[345]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + os=-sysv4 + ;; + i[345]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + os=-sysv + ;; + i[345]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + os=-solaris2 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + np1) + basic_machine=np1-gould + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | p6) + # We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium + basic_machine=i586-intel + ;; + pentium-* | p5-* | p6-*) + # We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + k5) + # We don't have specific support for AMD's K5 yet, so just call it a Pentium + basic_machine=i586-amd + ;; + nexen) + # We don't have specific support for Nexgen yet, so just call it a Pentium + basic_machine=i586-nexgen + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + mips) + basic_machine=mips-mips + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -unixware* | svr4*) + os=-sysv4 + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[345]* \ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigados* | -msdos* | -newsos* | -unicos* | -aos* \ + | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \ + | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* ) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -ctix* | -uts*) + os=-sysv + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -xenix) + os=-xenix + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-ibm) + os=-aix + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigados + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -lynxos*) + vendor=lynx + ;; + -aix*) + vendor=ibm + ;; + -hpux*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxworks*) + vendor=wrs + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/configure b/ACE/apps/JAWS/clients/WebSTONE/src/configure new file mode 100755 index 00000000000..8e1ad6e8369 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/configure @@ -0,0 +1,2132 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.7 +# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_default_prefix=bin + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.7" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=webclient.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='echo $CPP $CPPFLAGS 1>&5; +$CPP $CPPFLAGS' +ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5; +${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' +ac_link='echo ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5; +${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +PRODUCT=webstone +VERSION=2.0b4 +cat >> confdefs.h <<EOF +#define PRODUCT "$PRODUCT" +EOF + +cat >> confdefs.h <<EOF +#define VERSION "$VERSION" +EOF + + + + + +# set system type +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`$ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`$ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`$ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`$ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +# +# checks for programs +# +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +set dummy ${MAKE-make}; ac_make=$2 +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +for ac_prog in mawk gawk nawk awk +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AWK="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AWK="$ac_cv_prog_AWK" +if test -n "$AWK"; then + echo "$ac_t""$AWK" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AWK" && break +done + + + +# We use a path for perl so the #! line in bin/wscollect.pl will work. +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$PERL" in + /*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_PERL="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="no" + ;; +esac +fi +PERL="$ac_cv_path_PERL" +if test -n "$PERL"; then + echo "$ac_t""$PERL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +if test "$PERL" != no; then + PERL_SCRIPTS="bin/wscollect.pl" +else + echo "configure: warning: Some functions may work correctly" 1>&2 +fi + +# +# checks for libraries +# +# Replace `main' with a function in -lm: +echo $ac_n "checking for -lm""... $ac_c" 1>&6 +ac_lib_var=`echo m | tr '.-/+' '___p'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lm $LIBS" +cat > conftest.$ac_ext <<EOF +#line 832 "configure" +#include "confdefs.h" + +int main() { return 0; } +int t() { +floor() +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo m | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lm $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for -lcompat""... $ac_c" 1>&6 +ac_lib_var=`echo compat | tr '.-/+' '___p'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lcompat $LIBS" +cat > conftest.$ac_ext <<EOF +#line 872 "configure" +#include "confdefs.h" + +int main() { return 0; } +int t() { +rexec() +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo compat | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lcompat $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for -lucb""... $ac_c" 1>&6 +ac_lib_var=`echo ucb | tr '.-/+' '___p'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lucb $LIBS" +cat > conftest.$ac_ext <<EOF +#line 912 "configure" +#include "confdefs.h" + +int main() { return 0; } +int t() { +wait3() +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo ucb | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lucb $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for -lsocket""... $ac_c" 1>&6 +ac_lib_var=`echo socket | tr '.-/+' '___p'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket -lnsl $LIBS" +cat > conftest.$ac_ext <<EOF +#line 952 "configure" +#include "confdefs.h" + +int main() { return 0; } +int t() { +connect() +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo socket | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lsocket $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + + +# +# checks for header files +# +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +#line 1003 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +#line 1017 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +# If we cannot run a trivial program, we must be cross compiling. +echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_cross=yes +else +cat > conftest.$ac_ext <<EOF +#line 1051 "configure" +#include "confdefs.h" +main(){return(0);} +EOF +eval $ac_link +if test -s conftest && (./conftest; exit) 2>/dev/null; then + ac_cv_c_cross=no +else + ac_cv_c_cross=yes +fi +fi +rm -fr conftest* +fi + +echo "$ac_t""$ac_cv_c_cross" 1>&6 +cross_compiling=$ac_cv_c_cross + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1073 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> +EOF +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1095 "configure" +#include "confdefs.h" +#include <string.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1113 "configure" +#include "confdefs.h" +#include <stdlib.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else +cat > conftest.$ac_ext <<EOF +#line 1134 "configure" +#include "confdefs.h" +#include <ctype.h> +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +eval $ac_link +if test -s conftest && (./conftest; exit) 2>/dev/null; then + : +else + ac_cv_header_stdc=no +fi +fi +rm -fr conftest* +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1169 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/wait.h> +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +int main() { return 0; } +int t() { +int s; +wait (&s); +s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + ac_cv_header_sys_wait_h=yes +else + rm -rf conftest* + ac_cv_header_sys_wait_h=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 +if test $ac_cv_header_sys_wait_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SYS_WAIT_H 1 +EOF + +fi + +for ac_hdr in fcntl.h limits.h sgtty.h sys/time.h unistd.h +do +ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1213 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +# +# checks for typedefs, structures, and compiler characteristics +# +echo $ac_n "checking for working const""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1250 "configure" +#include "confdefs.h" + +int main() { return 0; } +int t() { + +/* Ultrix mips cc rejects this. */ +typedef int charset[2]; const charset x; +/* SunOS 4.1.1 cc rejects this. */ +char const *const *ccp; +char **p; +/* NEC SVR4.0.2 mips cc rejects this. */ +struct point {int x, y;}; +static struct point const zero = {0,0}; +/* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in an arm + of an if-expression whose if-part is not a constant expression */ +const char *g = "string"; +ccp = &g + (g ? g-g : 0); +/* HPUX 7.0 cc rejects these. */ +++ccp; +p = (char**) ccp; +ccp = (char const *const *) p; +{ /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; +} +{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; +} +{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; +} +{ /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + ac_cv_c_const=yes +else + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1324 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "size_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1355 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <signal.h> +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { return 0; } +int t() { +int i; +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + ac_cv_type_signal=void +else + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <<EOF +#define RETSIGTYPE $ac_cv_type_signal +EOF + + +echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1395 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +#include <time.h> +int main() { return 0; } +int t() { +struct tm *tp; +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + ac_cv_header_time=yes +else + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + +echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1429 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <time.h> +int main() { return 0; } +int t() { +struct tm *tp; tp->tm_sec; +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + ac_cv_struct_tm=time.h +else + rm -rf conftest* + ac_cv_struct_tm=sys/time.h +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_struct_tm" 1>&6 +if test $ac_cv_struct_tm = sys/time.h; then + cat >> confdefs.h <<\EOF +#define TM_IN_SYS_TIME 1 +EOF + +fi + +echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1462 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <$ac_cv_struct_tm> +int main() { return 0; } +int t() { +struct tm tm; tm.tm_zone; +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + ac_cv_struct_tm_zone=yes +else + rm -rf conftest* + ac_cv_struct_tm_zone=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6 +if test "$ac_cv_struct_tm_zone" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_TM_ZONE 1 +EOF + +else + echo $ac_n "checking for tzname""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1494 "configure" +#include "confdefs.h" +#include <time.h> +#ifndef tzname /* For SGI. */ +extern char *tzname[]; /* RS6000 and others reject char **tzname. */ +#endif +int main() { return 0; } +int t() { +atoi(*tzname); +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + ac_cv_var_tzname=yes +else + rm -rf conftest* + ac_cv_var_tzname=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_var_tzname" 1>&6 + if test $ac_cv_var_tzname = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_TZNAME 1 +EOF + + fi +fi + +cat > conftest.$ac_ext <<EOF +#line 1526 "configure" +#include "confdefs.h" +#include <sys/time.h> +int main() { return 0; } +int t() { +struct timeval thetime; struct timezone thezone; + gettimeofday(&thetime, &thezone); +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define USE_TIMEZONE 1 +EOF + +fi +rm -f conftest* + + +# +# checks for library functions +# +echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_memcmp'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp=no +else +cat > conftest.$ac_ext <<EOF +#line 1556 "configure" +#include "confdefs.h" + +main() +{ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1); +} + +EOF +eval $ac_link +if test -s conftest && (./conftest; exit) 2>/dev/null; then + ac_cv_func_memcmp=yes +else + ac_cv_func_memcmp=no +fi +fi +rm -fr conftest* +fi + +echo "$ac_t""$ac_cv_func_memcmp" 1>&6 +test $ac_cv_func_memcmp = no && LIBOBJS="$LIBOBJS memcmp.o" + +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1584 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <signal.h> +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { return 0; } +int t() { +int i; +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + ac_cv_type_signal=void +else + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <<EOF +#define RETSIGTYPE $ac_cv_type_signal +EOF + + +echo $ac_n "checking for vprintf""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1624 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char vprintf(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +char vprintf(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_vprintf) || defined (__stub___vprintf) +choke me +#else +vprintf(); +#endif + +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_func_vprintf=yes" +else + rm -rf conftest* + eval "ac_cv_func_vprintf=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_VPRINTF 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +if test "$ac_cv_func_vprintf" != yes; then +echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1672 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char _doprnt(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +char _doprnt(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub__doprnt) || defined (__stub____doprnt) +choke me +#else +_doprnt(); +#endif + +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_func__doprnt=yes" +else + rm -rf conftest* + eval "ac_cv_func__doprnt=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_DOPRNT 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +fi + +echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_wait3'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_wait3=no +else +cat > conftest.$ac_ext <<EOF +#line 1724 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <stdio.h> +/* HP-UX has wait3 but does not fill in rusage at all. */ +main() { + struct rusage r; + int i; + /* Use a field that we can force nonzero -- + voluntary context switches. + For systems like NeXT and OSF/1 that don't set it, + also use the system CPU time. And page faults (I/O) for Linux. */ + r.ru_nvcsw = 0; + r.ru_stime.tv_sec = 0; + r.ru_stime.tv_usec = 0; + r.ru_majflt = r.ru_minflt = 0; + switch (fork()) { + case 0: /* Child. */ + sleep(1); /* Give up the CPU. */ + _exit(0); + case -1: _exit(0); /* What can we do? */ + default: /* Parent. */ + wait3(&i, 0, &r); + sleep(2); /* Avoid "text file busy" from rm on fast HP-UX machines. */ + exit(r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0 + && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0); + } +} +EOF +eval $ac_link +if test -s conftest && (./conftest; exit) 2>/dev/null; then + ac_cv_func_wait3=yes +else + ac_cv_func_wait3=no +fi +fi +rm -fr conftest* +fi + +echo "$ac_t""$ac_cv_func_wait3" 1>&6 +if test $ac_cv_func_wait3 = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_WAIT3 1 +EOF + +fi + +for ac_func in gethostname gettimeofday select socket strerror +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1780 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +char $ac_func(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +# +# checks for system services +# + +# +# all done +# +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.7" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir + +trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@PRODUCT@%$PRODUCT%g +s%@VERSION@%$VERSION%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@CC@%$CC%g +s%@SET_MAKE@%$SET_MAKE%g +s%@AWK@%$AWK%g +s%@PERL@%$PERL%g +s%@PERL_SCRIPTS@%$PERL_SCRIPTS%g +s%@CPP@%$CPP%g +s%@LIBOBJS@%$LIBOBJS%g + +CEOF +EOF +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust relative srcdir, etc. for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +fi; done +rm -f conftest.subs + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +CONFIG_HEADERS=${CONFIG_HEADERS-"config.h"} +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + cp $ac_given_srcdir/$ac_file_in conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. +# Maximum number of lines to put in a single here document. +ac_max_here_lines=12 + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + + + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +# +# end diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/configure.in b/ACE/apps/JAWS/clients/WebSTONE/src/configure.in new file mode 100644 index 00000000000..449a6a16cef --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/configure.in @@ -0,0 +1,99 @@ +# configure.in +# Configure template for WebStone +# Process this file with autoconf to produce a configure script. +# +# This file and all files contained in this directory are +# copyright 1995, Silicon Graphics, Inc. +# +# This software is provided without support and without any obligation on the +# part of Silicon Graphics, Inc. to assist in its use, correction, modification +# or enhancement. There is no guarantee that this software will be included in +# future software releases, and it probably will not be included. +# +# THIS SOFTWARE IS PROVIDED "AS IS" WITH NO WARRANTIES OF ANY KIND INCLUDING +# THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR +# PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. +# +# In no event will Silicon Graphics, Inc. be liable for any lost revenue or +# profits or other special, indirect and consequential damages, even if +# Silicon Graphics, Inc. has been advised of the possibility of such damages. + +AC_INIT(webclient.c) +AC_CONFIG_HEADER(config.h) +PRODUCT=webstone +VERSION=2.0b6 +AC_DEFINE_UNQUOTED(PRODUCT, "$PRODUCT") +AC_DEFINE_UNQUOTED(VERSION, "$VERSION") +AC_SUBST(PRODUCT) +AC_SUBST(VERSION) +AC_PREFIX_DEFAULT(bin) + +# set system type +AC_CANONICAL_SYSTEM + +# +# checks for programs +# +AC_PROG_CC +AC_PROG_MAKE_SET +AC_PROG_AWK + + +# We use a path for perl so the #! line in bin/wscollect.pl will work. +AC_PATH_PROG(PERL, perl, no) +AC_SUBST(PERL) +AC_SUBST(PERL_SCRIPTS) +if test "$PERL" != no; then + PERL_SCRIPTS="bin/wscollect.pl" +else + AC_MSG_WARN(Some functions may work correctly, since perl was not found) +fi + +# +# checks for libraries +# +# Replace `main' with a function in -lm: +AC_CHECK_LIB(m, floor) +AC_CHECK_LIB(compat, rexec) +AC_CHECK_LIB(ucb, wait3) +AC_CHECK_LIB(socket, connect, AC_SUBST(LIBS), , -lnsl) + +# +# checks for header files +# +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(fcntl.h limits.h sgtty.h sys/time.h unistd.h) + +# +# checks for typedefs, structures, and compiler characteristics +# +AC_C_CONST +AC_TYPE_SIZE_T +AC_TYPE_SIGNAL +AC_HEADER_TIME +AC_STRUCT_TIMEZONE +AC_TRY_COMPILE([#include <sys/time.h>], + [struct timeval thetime; struct timezone thezone; + gettimeofday(&thetime, &thezone); ], + AC_DEFINE(USE_TIMEZONE), ) + +# +# checks for library functions +# +AC_FUNC_MEMCMP +AC_TYPE_SIGNAL +AC_FUNC_VPRINTF +AC_FUNC_WAIT3 +AC_CHECK_FUNCS(gethostname gettimeofday select socket strerror) + +# +# checks for system services +# + +# +# all done +# +AC_OUTPUT(Makefile) +# +# end diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/debug.h b/ACE/apps/JAWS/clients/WebSTONE/src/debug.h new file mode 100644 index 00000000000..2322c287931 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/debug.h @@ -0,0 +1,18 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ +#ifndef __DEBUG_H__ + +#define D_PRINTF debug && fprintf(debugfile, +#define D_FLUSH );fflush(debugfile) + +#define __DEBUG_H__ +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/errexit.c b/ACE/apps/JAWS/clients/WebSTONE/src/errexit.c new file mode 100644 index 00000000000..a9bc024d4b6 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/errexit.c @@ -0,0 +1,106 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +/* errexit call for general error handling */ + +#include <stdio.h> +#ifndef WIN32 +#include <errno.h> +#include <netdb.h> +#include <unistd.h> +#endif /* WIN32 */ +#include <stdarg.h> +#include <sys/types.h> + +#include "sysdep.h" +#include "bench.h" + +#ifdef HAVE_VPRINTF +#define VPRINTF(stderr, format, args) vfprintf((stderr), (format), (args)) +#else +#ifdef HAVE_DOPRNT +#define VPRINTF(stderr, format, args) _doprnt((format), (args), (stderr)) +#endif /* HAVE_DOPRNT */ +#endif /* HAVE_VPRINTF */ + +/* print an error message and exit 1 */ +void +errexit(const char *format, ...) +{ +va_list args; +char hostname[64] = ""; +pid_t PID; + + PID = getpid(); + gethostname(hostname, sizeof(hostname)); + fprintf(stderr, "%s PID %d: ", hostname, PID); + + va_start(args, format); + VPRINTF(stderr, format, args); + debug && VPRINTF(debugfile, format, args); + va_end(args); + fflush(stderr); + exit(1); +} +/* that's it */ + +/* print an error message and return -1 */ +int +returnerr(const char *format, ...) +{ +va_list args; +char hostname[64] = ""; +pid_t PID; + + PID = getpid(); + gethostname(hostname, sizeof(hostname)); + fprintf(stderr, "%s PID %d: ", hostname, PID); + + va_start(args, format); + VPRINTF(stderr, format, args); + debug && VPRINTF(debugfile, format, args); + va_end(args); + fflush(stderr); + debug && fflush(debugfile); + return(-1); +} +/* that's it */ + +/* print a debug message and then flush */ +int +d_printf(const char *format, ...) +{ +va_list args; + + va_start(args, format); + VPRINTF(debugfile, format, args); + va_end(args); + + fflush(debugfile); + return 0; +} +/* that's it */ + +/* returns the last network error as a string */ +char *neterrstr(void) { +static char buf[200]; + +#ifdef WIN32 + sprintf(buf, "WSAGetLastError() = %d", WSAGetLastError()); + WSASetLastError(0); +#else + sprintf(buf, "errno = %d: %s", errno, strerror(errno)); + errno = 0; +#endif /* WIN32 */ + + return buf; +} diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/genrand.c b/ACE/apps/JAWS/clients/WebSTONE/src/genrand.c new file mode 100644 index 00000000000..65f54fbc839 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/genrand.c @@ -0,0 +1,62 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +/* FUZZ: disable check_for_math_include */ +#include <stdio.h> +#include <fcntl.h> +#include <math.h> + +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "sysdep.h" + +void +main(const int argc, char* argv[]) +{ + FILE* file; + int i; + int my_random; + int size; + char *cp; + + if (argc != 3) { + printf("usage: %s file_size_in_bytes[K|M] name\n", argv[0]); + exit(2); + } + + if ((file = fopen(argv[2], "w")) == NULL) { + perror("fopen"); + exit(1); + } + + size = atoi(argv[1]); + for (cp = argv[1]; *cp; cp++) { + switch(*cp) { + case 'k': + case 'K': + size *= 1024; + break; + case 'm': + case 'M': + size *= 1024*1024; + break; + } + } + + for (i = 0; i < size; i++) { + my_random = ((RANDOM() % 94) + 33); + fputc((char)my_random, file); + } + + fclose(file); +} diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/get.c b/ACE/apps/JAWS/clients/WebSTONE/src/get.c new file mode 100644 index 00000000000..8a6d9232deb --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/get.c @@ -0,0 +1,318 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +/* THIS IS WHERE WE GO OUT AND FETCH A URL */ + +#include <stdio.h> +#include <errno.h> + +#ifndef WIN32 +#include <sys/types.h> +#include <sys/errno.h> +#include <sys/socket.h> +#include <sys/param.h> +#include <netinet/in.h> +#include <netdb.h> +#endif /* WIN32 */ + +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#ifdef SUNOS +#include <unistd.h> +#endif +#include <ctype.h> + +#ifdef WIN32 +#include <io.h> +#include <windows.h> +#include <winsock.h> +#endif /* WIN32 */ + +#include "sysdep.h" +#include "bench.h" + +#define ACCEPT_COMMAND "Accept: */* HTTP/1.0\r\n\r\n" +#define ACCEPT_COMMAND_LEN ((int)strlen(ACCEPT_COMMAND)) +#define MAXCOMMANDLEN 256 +#define HEADERBUFSIZ (8*1024) + +#define UPPER(c) (((c) >= 'a' && (c) <= 'z') ? (c) + 'A' - 'a' : (c)) + +/* compare two strings with max length, ignoring case */ +int mystrincmp(const char *str1, const char *str2, int len) { +register int diff; + + while (*str1 && *str2 && len--) { + if (diff = UPPER(*str1) - UPPER(*str2)) + return diff < 0 ? -1 : 1; + str1++; + str2++; + } + return 0; +} + +int +get(char *loc, NETPORT port, char *url, rqst_timer_t *timer) +{ + SOCKET sock = BADSOCKET_VALUE; + int writelen; + int bytesread; + int totalbytesread; + int headerlen; + int bodylength; + int contentlength = 0; + int outputfile = -1; + int status; + char getcommand[MAXCOMMANDLEN]; + char headerbuffer[HEADERBUFSIZ+1]; + char *offset; + char outputfilename[MAXPATHLEN]; + char version[100]; + int count; + +/*#define ABORTIVE_CLOSE 1*/ +#ifdef ABORTIVE_CLOSE +#error don't enable this option + struct linger { + int l_onoff; + int l_linger; + } linger_opt; +#endif /* ABORTIVE_CLOSE */ + + /* can you really get an error from gettimeofday?? */ + if(GETTIMEOFDAY(&timer->entertime, &timer->entertimezone) != 0) + { + returnerr("Error retrieving entertime\n"); + goto error; + } + timer->valid = 1; + + if(GETTIMEOFDAY(&timer->beforeconnect, &timer->beforeconnectzone) != 0) + { + returnerr("Error retrieving beforeconnect\n"); + goto error; + } + + sock = connectsock(loc, port, "tcp"); + if (BADSOCKET(sock)) + { + D_PRINTF( "Call to connectsock returned %d (%s)\n", sock, neterrstr() ); + returnerr("Couldn't connect to WWW server: %s\n", neterrstr()); + goto error; + } + +#ifdef ABORTIVE_CLOSE +#error don't enable this option + /* set up for abortive close */ + linger_opt.l_onoff = 1; + linger_opt.l_linger = 0; + if (setsockopt(sock, SOL_SOCKET, SO_LINGER, + (char *) &linger_opt, sizeof(linger_opt)) < 0) { + fprintf(stderr, "Can't set sockopt SO_LINGER"); + returnerr("Couldn't set SO_LINGER = 0\n"); + goto error; + } +#endif /* ABORTIVE_CLOSE */ + + if(GETTIMEOFDAY(&timer->afterconnect, &timer->afterconnectzone) != 0) + { + NETCLOSE(sock); + GETTIMEOFDAY(&timer->exittime, &timer->exittimezone); + returnerr("Error retrieving afterconnect\n"); + goto error; + } + + /* + * SEND THE GET AND THE ACCEPT. + */ + sprintf(getcommand, "GET %s HTTP/1.0\r\n%s", url, + ACCEPT_COMMAND); + D_PRINTF( "Writing to server: %s\n", getcommand ); + writelen = strlen(getcommand); + status = NETWRITE(sock, getcommand, writelen); + if(status != writelen) + { + returnerr("Error sending command line to server: %s\n", + neterrstr()); + goto error; + } + /* + * WE HAVE NOW SENT THE REQUEST SUCCESSFULLY. + * WAIT FOR THE REPLY AND FIND THE HEADER + */ + + if(GETTIMEOFDAY(&timer->beforeheader, &timer->beforeheaderzone) != 0) + { + returnerr("Error retrieving beforeheader\n"); + goto error; + } + + /* read the header and part of the file */ + totalbytesread = 0; + headerlen = 0; + while (totalbytesread < HEADERBUFSIZ) + { + bytesread = NETREAD(sock, headerbuffer+totalbytesread, HEADERBUFSIZ-totalbytesread); + if (BADSOCKET(bytesread)) + { + D_PRINTF( "Did not receive full header\n" ); + D_PRINTF( "NETREAD returned %d\n", bytesread ); + returnerr("Did not receive full header: %s\n", + neterrstr()); + goto error; + } + totalbytesread += bytesread; + + /* search for end of header */ + headerbuffer[totalbytesread] = 0; + if (offset = strstr(headerbuffer, "\n\n")) { + headerlen = offset - headerbuffer + 2; + break; + } else if (offset = strstr(headerbuffer, "\n\r\n")) { + headerlen = offset - headerbuffer + 3; + break; + } + } + + if (headerlen == 0) { + returnerr("Can't find the end of the header in \"%s\"\n", headerbuffer); + goto error; + } + + /* get and check status code from the first line of the header */ + count = sscanf(headerbuffer, "HTTP/%s %d", version, &status); + if (count != 2) { + returnerr("Bad status line in get(): %s\n", headerbuffer); + goto error; + } + if (status < 200 || status > 300) { + returnerr("Bad status (%d) in get() for url %s\n", status, url); + goto error; + } + + /* get the content length line from the header */ + offset = headerbuffer; + while (offset < headerbuffer+headerlen && *offset) { + if (*offset++ != '\n') + continue; + + if (mystrincmp(offset, CONTENT_LENGTH_STRING, strlen(CONTENT_LENGTH_STRING)) == 0) { + sscanf(offset+strlen(CONTENT_LENGTH_STRING), "%d", &contentlength); + D_PRINTF( "Content-Length: %d\n", contentlength ); + } + } + + if(GETTIMEOFDAY(&timer->afterheader, &timer->afterheaderzone) != 0) + { + returnerr("Error retrieving afterheader\n"); + goto error; + } + + if(savefile) + { + sprintf(outputfilename,"/tmp/webstone.data.%d", (int)getpid()); + if((outputfile = open(outputfilename,(O_WRONLY|O_CREAT),0777)) < 0) + { + D_PRINTF( "outputfile %d %d\n", outputfile, errno ); + returnerr("Error saving file: %s\n", strerror(errno)); + goto error; + } + lseek(outputfile,1,SEEK_END); /* this is odd... JEF */ + + /* if we have part of the file already, save that part */ + if(totalbytesread > headerlen) + { + write(outputfile, headerbuffer+headerlen, totalbytesread-headerlen); + } + } + + /* read the body of the file */ + do + { + bytesread = NETREAD(sock, headerbuffer, HEADERBUFSIZ); + D_PRINTF( "Read %d bytes from socket %d\n", bytesread, sock ); + + if (BADSOCKET(bytesread)) + { + D_PRINTF( "Read returns %d, error: %s\n", bytesread, + neterrstr() ); + returnerr("Error during read of page body. Read " + "returns %d on socket %d, error: %s\n", + bytesread, sock, neterrstr()); + goto error; + } + + totalbytesread += bytesread; + + if (outputfile != -1 && bytesread) + { + write(outputfile, headerbuffer, bytesread); + } + + } while (bytesread); + + /* done reading body */ + if ( contentlength && (totalbytesread - headerlen) != contentlength) + { + D_PRINTF( "Warning: file length (%d) doesn't match Content-length (%d)\n", + totalbytesread - headerlen, contentlength); + } + + bodylength = totalbytesread - headerlen; + + if(GETTIMEOFDAY(&timer->afterbody, &timer->afterbodyzone) != 0) + { + returnerr("Error retrieving afterbody\n"); + goto error; + } + + NETCLOSE(sock); + if (outputfile != -1) + { + close(outputfile); + } + + D_PRINTF( "Read %d bytes, %d of that being body\n", + totalbytesread, bodylength ); + + if(GETTIMEOFDAY(&timer->exittime, &timer->exittimezone) != 0) + { + D_PRINTF( "Error retrieving exit time: %s\n", strerror(errno) ); + returnerr("Error retrieving exit time\n"); + goto error; + } + timer->valid = 2; + timer->totalbytes = totalbytesread; + timer->bodybytes = bodylength; + + D_PRINTF( "get returning totalbytes %d body %d valid %d\n", + timer->totalbytes, timer->bodybytes, timer->valid ); + + D_PRINTF( "get returning start %d, end %d\n", + timer->entertime.tv_sec, timer->exittime.tv_sec ); + + D_PRINTF( "get returning connect %d, request %d, header %d, body %d\n", + timer->afterconnect.tv_sec, timer->beforeheader.tv_sec, + timer->afterheader.tv_sec, timer->afterbody.tv_sec ); + + return 0; + +error: + if (!BADSOCKET(sock)) + NETCLOSE(sock); + if (outputfile != -1) + close(outputfile); + GETTIMEOFDAY(&timer->exittime, &timer->exittimezone); /* needed? */ + return -1; +} diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/get.h b/ACE/apps/JAWS/clients/WebSTONE/src/get.h new file mode 100644 index 00000000000..57ac8707445 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/get.h @@ -0,0 +1,17 @@ +#ifndef __GET_H__ +#define __GET_H__ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs where * + * deveolped by SGI for public use. If anychanges are made to this code * + * please try to get the changes back to the author. Feel free to make * + * modfications and changes to the code and release it. * + * * + **************************************************************************/ + +extern int get(char *loc, int port, char *url, rqst_timer_t *timer); + +#endif /* !__GET_H__ */ diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/getopt.c b/ACE/apps/JAWS/clients/WebSTONE/src/getopt.c new file mode 100644 index 00000000000..fc0bbe7037a --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/getopt.c @@ -0,0 +1,67 @@ +/* $Id$ */ +/* this is a public domain version of getopt */ +/* FTP Site: ftp.uu.net/pub/OS/unix/bsd-sources/lib/librpc/etc/getopt.c */ + +#include <stdio.h> +#include <string.h> + +#define MYNULL 0 +#define ERR(s, c) if(opterr){\ + extern size_t strlen();\ + extern int write();\ + char errbuf[2];\ + errbuf[0] = c; errbuf[1] = '\n';\ + (void) write(2, argv[0], strlen(argv[0]));\ + (void) write(2, s, strlen(s));\ + (void) write(2, errbuf, 2);} + +int opterr = 1; +int optind = 1; +int optopt; +char *optarg; + +int +getopt(argc, argv, opts) +int argc; +char **argv, *opts; +{ + static int sp = 1; + register int c; + register char *cp; + + if(sp == 1) + if(optind >= argc || + argv[optind][0] != '-' || argv[optind][1] == '\0') + return(EOF); + else if(strcmp(argv[optind], "--") == MYNULL) { + optind++; + return(EOF); + } + optopt = c = argv[optind][sp]; + if(c == ':' || (cp=strchr(opts, c)) == NULL) { + ERR(": unknown option, -", c); + if(argv[optind][++sp] == '\0') { + optind++; + sp = 1; + } + return('?'); + } + if(*++cp == ':') { + if(argv[optind][sp+1] != '\0') + optarg = &argv[optind++][sp+1]; + else if(++optind >= argc) { + ERR(": argument missing for -", c); + sp = 1; + return('?'); + } else + optarg = argv[optind++]; + sp = 1; + } else { + if(argv[optind][++sp] == '\0') { + sp = 1; + optind++; + } + optarg = NULL; + } + return(c); +} diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/gettimeofday.c b/ACE/apps/JAWS/clients/WebSTONE/src/gettimeofday.c new file mode 100644 index 00000000000..7c685ad90c5 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/gettimeofday.c @@ -0,0 +1,57 @@ +/* $Id$ */ + +/* + * This file defines functions that are required for unix compatibility. + * + * These functions are not available in the Microsoft C/C++ Run Time + * and the Win32 API. + * + * The following functions list may not be complete + * + * FUNCTIONS: + * SHARED _gettimeofday + * + */ + + +#include <windows.h> +#include <errno.h> +#include <winsock.h> /* For definition of "timeval" structure */ +#include <sys/timeb.h> /* For prototype of "_ftime()" */ + + +/* + * gettimeofday() -- gets the current time in elapsed seconds and + * microsends since GMT Jan 1, 1970. + * + * ARGUMENTS: - Pointer to a timeval struct to return the time into + * + * RETURN CODES: - 0 on success + * -1 on failure + */ +int gettimeofday(curTimeP) + struct timeval *curTimeP; +{ +struct _timeb localTime; + + if (curTimeP == (struct timeval *) NULL) { + errno = EFAULT; + return (-1); + } + + /* + * Compute the elapsed time since Jan 1, 1970 by first + * obtaining the elapsed time from the system using the + * _ftime(..) call and then convert to the "timeval" + * equivalent. + */ + + _ftime(&localTime); + + curTimeP->tv_sec = localTime.time + localTime.timezone; + curTimeP->tv_usec = localTime.millitm * 1000; + + return(0); +} + + diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/install-sh b/ACE/apps/JAWS/clients/WebSTONE/src/install-sh new file mode 100755 index 00000000000..89fc9b098b8 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/install-sh @@ -0,0 +1,238 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +tranformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/logfile27859 b/ACE/apps/JAWS/clients/WebSTONE/src/logfile27859 new file mode 100644 index 00000000000..a65984d6f9a --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/logfile27859 @@ -0,0 +1,9 @@ + entertime 867794927.279188 + beforeconnect 867794927.279189 + afterconnect 867794927.280504 + beforeheader 867794927.280604 + afterheader 867794927.299170 + afterbody 867794932.215967 + exittime 867794932.216306 + total bytes 5243057 + body bytes 5242880 diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/buffer.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/buffer.h new file mode 100644 index 00000000000..f172efcb93a --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/buffer.h @@ -0,0 +1,220 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * buffer.h: For performing buffered I/O on a file or socket descriptor. + * + * This is an abstraction to allow I/O to be performed regardless of the + * current system. That way, an integer file descriptor can be used under + * UNIX but a stdio FILE structure could be used on systems which don't + * support that or don't support it as efficiently. + * + * Two abstractions are defined: A file buffer, and a network buffer. A + * distinction is made so that mmap() can be used on files (but is not + * required). Also, the file buffer takes a file name as the object to + * open instead of a file descriptor. A lot of the network buffering + * is almost an exact duplicate of the non-mmap file buffering. + * + * If an error occurs, system-independent means to obtain an error string + * are also provided. However, if the underlying system is UNIX the error + * may not be accurate in a threaded environment. + * + * Rob McCool + * + */ + + +#ifndef BUFFER_H +#define BUFFER_H + +#ifdef XP_WIN32 +#include <nt/ntbuffer.h> +#else + + +/* + * We need certain system specific functions and symbols. + */ + +#include "file.h" +#include "net.h" + +/* + * Requires that the macro MALLOC be set to a "safe" malloc that will + * exit if no memory is available. If not under MCC httpd, define MALLOC + * to be the real malloc and play with fire, or make your own function. + */ + +#include "../netsite.h" + +#ifdef FILE_UNIX_MMAP +#include <sys/types.h> /* caddr_t */ +#endif + + +/* ------------------------------ Structures ------------------------------ */ + +#ifdef FILE_UNIX_MMAP +typedef struct { + SYS_FILE fd; + caddr_t fp; + int len; + + char *inbuf; /* for buffer_grab */ + int cursize; + + int pos; + char *errmsg; +} filebuf; + +#else + +typedef struct { + SYS_FILE fd; + + int pos, cursize, maxsize; + char *inbuf; + char *errmsg; +} filebuf; + +#endif + +typedef struct { + SYS_NETFD sd; + + int pos, cursize, maxsize, rdtimeout; + char *inbuf; + char *errmsg; +} netbuf; + + +/* -------------------------------- Macros -------------------------------- */ + + +/* + * netbuf_getc gets a character from the given network buffer and returns + * it. (as an integer). + * + * It will return (int) IO_ERROR for an error and (int) IO_EOF for + * an error condition or EOF respectively. + */ + +#define netbuf_getc(b) \ + ((b)->pos != (b)->cursize ? (int)((b)->inbuf[(b)->pos++]) : netbuf_next(b,1)) + +#ifdef FILE_UNIX_MMAP +#define filebuf_getc(b) ((b)->pos == (b)->len ? IO_EOF : (b)->fp[(b)->pos++]) +#else +#define filebuf_getc(b) \ + ((b)->pos != (b)->cursize ? (int)((b)->inbuf[(b)->pos++]) : filebuf_next(b,1)) +#endif + + +/* + * buffer_error returns the last error that occurred with buffer. Don't use + * this unless you know an error occurred. Independent of network/file type. + */ + +#define buffer_error(b) ((b)->errmsg) + +/* + * buffer_flush flushes any data after the current pos to the file + * descriptor fd. Regardless of buffer type. + */ + +#define buffer_flush(buf,fd) \ + system_write(fd,&(buf)->inbuf[(buf)->pos], (buf)->cursize - (buf)->pos) + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * buffer_open opens a new buffer reading the specified file, with an I/O + * buffer of size sz, and returns a new buffer structure which will hold + * the data. + * + * If FILE_UNIX_MMAP is defined, this may return NULL. If it does, check + * system_errmsg to get a message about the error. + */ + +filebuf *filebuf_open(SYS_FILE fd, int sz); +netbuf *netbuf_open(SYS_NETFD sd, int sz); + +/* + * filebuf_open_nostat is a convenience function for mmap() buffer opens, + * if you happen to have the stat structure already. + */ + +#ifdef FILE_UNIX_MMAP +#include <sys/stat.h> +filebuf *filebuf_open_nostat(SYS_FILE fd, int sz, struct stat *finfo); + +#else +#define filebuf_open_nostat(fd,sz,finfo) filebuf_open(fd,sz) +#endif + +/* + * buffer_next loads size more bytes into the given buffer and returns the + * first one, or BUFFER_EOF on EOF and BUFFER_ERROR on error. + */ + +int filebuf_next(filebuf *buf, int advance); +int netbuf_next(netbuf *buf, int advance); + +/* + * buffer_close deallocates a buffer and closes its associated files + * (does not close a network socket). + */ + +void filebuf_close(filebuf *buf); +void netbuf_close(netbuf *buf); + +/* + * buffer_grab will set the buffer's inbuf array to an array of sz bytes + * from the buffer's associated object. It returns the number of bytes + * actually read (between 1 and sz). It returns IO_EOF upon EOF or IO_ERROR + * upon error. The cursize entry of the structure will reflect the size + * of the iobuf array. + * + * The buffer will take care of allocation and deallocation of this array. + */ + +int filebuf_grab(filebuf *buf, int sz); +int netbuf_grab(netbuf *buf, int sz); + + +/* + * netbuf_buf2sd will send n bytes from the (probably previously read) + * buffer and send them to sd. If sd is -1, they are discarded. If n is + * -1, it will continue until EOF is recieved. Returns IO_ERROR on error + * and the number of bytes sent any other time. + */ + +int netbuf_buf2sd(netbuf *buf, SYS_NETFD sd, int len); + +/* + * filebuf_buf2sd assumes that nothing has been read from the filebuf, + * and just sends the file out to the given socket. Returns IO_ERROR on error + * and the number of bytes sent otherwise. + * + * Does not currently support you having read from the buffer previously. This + * can be changed transparently. + */ + +int filebuf_buf2sd(filebuf *buf, SYS_NETFD sd); + +#endif +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/cinfo.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/cinfo.h new file mode 100644 index 00000000000..13849531fd2 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/cinfo.h @@ -0,0 +1,146 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * cinfo.h: Content Information for a file, i.e. its type, etc. + * + * See cinfo.c for dependency information. + * + * Rob McCool + */ + + + +#ifndef CINFO_H +#define CINFO_H + + + +/* ------------------------------ Constants ------------------------------- */ + + +/* + * This will be the first string in the file, followed by x.x version + * where x is an integer. + * + * Updated due to trendy name change + */ + +#define MCC_MT_MAGIC "#--Mosaic Communications Corporation MIME Information" +#define MCC_MT_MAGIC_LEN 53 +#define NCC_MT_MAGIC "#--Netscape Communications Corporation MIME Information" +#define NCC_MT_MAGIC_LEN 55 + +/* The character which separates extensions with cinfo_find */ + +#define CINFO_SEPARATOR '.' + +/* The maximum length of a line in this file */ + +#define CINFO_MAX_LEN 1024 + +/* The hash function for the database. Hashed on extension. */ +#include <ctype.h> +#define CINFO_HASH(s) (isalpha(s[0]) ? tolower(s[0]) - 'a' : 26) + +/* The hash table size for that function */ +#define CINFO_HASHSIZE 27 + + +/* ------------------------------ Structures ------------------------------ */ + + +/* + * The ContentInfo structure. + * + * Currently, we support the following attributes: + * + * 1. Type: This identifies what kind of data is in the file. + * 2. Encoding: Identifies any compression or otherwise content-independent + * transformation which has been applied to the file (uuencode, etc.) + * 3. Language: Identifies the language a text document is in. + * 4. Description: A text string describing the file. + * 5. Viewer: The program to use to view the file. + * + * Multiple items are separated with a comma, e.g. + * encoding="x-gzip, x-uuencode" + */ + +typedef struct { + char *type; + char *encoding; + char *language; +} cinfo; + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * cinfo_init initializes the content info system. Call this before + * cinfo_merge. + */ + +void cinfo_init(void); + +/* + * cinfo_terminate frees the database for shutdown. + */ + +void cinfo_terminate(void); + +/* + * cinfo_merge merges the contents of the given filename with the current + * cinfo database. It returns NULL upon success and a string (which you + * must deallocate) upon error. + */ + +char *cinfo_merge(char *fn); + + +/* + * cinfo_find finds any content information for the given uri. The file name + * is the string following the last / in the uri. Multiple extensions are + * separated by CINFO_SEPARATOR. You may pass in a filename instead of uri. + * + * Returns a newly allocated cinfo structure with the information it + * finds. The elements of this structure are coming right out of the types + * database and so if you change it or want to keep it around for long you + * should strdup it. You should free only the structure itself when finished + * with it. + * + * If there is no information for any one of the extensions it + * finds, it will ignore that extension. If it cannot find information for + * any of the extensions, it will return NULL. + */ + +cinfo *cinfo_find(char *uri); + +/* + * cinfo_lookup finds the information about the given content-type, and + * returns a cinfo structure so you can look up description and icon. + */ + +cinfo *cinfo_lookup(char *type); + +/* + * cinfo_dump_database dumps the current database to the given file desc. + */ + +#include <stdio.h> +void cinfo_dump_database(FILE *dump); + + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/crit.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/crit.h new file mode 100644 index 00000000000..c661be47eef --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/crit.h @@ -0,0 +1,127 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * crit.h: Critical section abstraction. Used in threaded servers to protect + * areas where two threads can interfere with each other. + * + * Condvars are condition variables that are used for thread-thread + * synchronization. + * + * Rob McCool + */ + +#ifndef CRIT_H +#define CRIT_H + + +#ifdef USE_NSPR +#include <nspr/prmon.h> +typedef PRMonitor* CRITICAL; +#else +typedef void *CRITICAL; +#endif + +/* + * crit_init creates and returns a new critical section variable. At the + * time of creation no one has entered it. + */ +#ifdef USE_NSPR +#define crit_init() PR_NewMonitor(0) +#else +#define crit_init() (NULL) +#endif + +/* + * crit_enter enters a critical section. If someone is already in the + * section, the calling thread is blocked until that thread exits. + */ +#ifdef USE_NSPR +#define crit_enter(id) PR_EnterMonitor(id) +#else +#define crit_enter(id) (0) +#endif + +/* + * crit_exit exits a critical section. If another thread is blocked waiting + * to enter, it will be unblocked and given ownership of the section. + */ +#ifdef USE_NSPR +#define crit_exit(id) PR_ExitMonitor(id) +#else +#define crit_exit(id) (0) +#endif + +/* + * crit_terminate removes a previously allocated critical section variable. + */ +#ifdef USE_NSPR +#define crit_terminate(id) PR_DestroyMonitor(id) +#else +#define crit_terminate(id) (0) +#endif + + +#ifdef USE_NSPR +typedef PRMonitor* CONDVAR; +#else +typedef void* CONDVAR; +#endif + +/* + * condvar_init initializes and returns a new condition variable. You + * must provide a critical section to be associated with this condition + * variable. + */ +#ifdef USE_NSPR +#define condvar_init(crit) (crit) +#else +#define condvar_init(crit) (crit) +#endif + +/* + * condvar_wait blocks on the given condition variable. The calling thread + * will be blocked until another thread calls condvar_notify on this variable. + * The caller must have entered the critical section associated with this + * condition variable prior to waiting for it. + */ +#ifdef USE_NSPR +#define condvar_wait(cv) (PR_Wait(cv, LL_MAXINT)) +#else +#define condvar_wait(cv) (0) +#endif + +/* + * condvar_notify awakens any threads blocked on the given condition + * variable. The caller must have entered the critical section associated + * with this variable first. + */ +#ifdef USE_NSPR +#define condvar_notify(cv) (PR_Notify(cv)) +#else +#define condvar_notify(cv) (0) +#endif + +/* + * condvar_terminate frees the given previously allocated condition variable + */ +#ifdef USE_NSPR +#define condvar_terminate(cv) (0) +#else +#define condvar_terminate(cv) (0) +#endif + + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/daemon.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/daemon.h new file mode 100644 index 00000000000..afe0cfe6e5e --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/daemon.h @@ -0,0 +1,120 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * daemon.h: Things related to the accepting connections + * + * Rob McCool + */ + + +#ifndef DAEMON_H +#define DAEMON_H + +#ifdef XP_WIN32 +#include <nt/ntdaemon.h> +#else + +#include "net.h" +#include "session.h" + +#include <pwd.h> /* struct passwd */ + + +/* ------------------------------- Defines -------------------------------- */ + + +#define child_exit exit + + +/* Codes for child_status */ +#define CHILD_EMPTY_SLOT 0xfe +#define CHILD_AWAIT_CONNECT 0xff +#define CHILD_PROCESSING 0x00 +#define CHILD_READING 0x01 +#define CHILD_WRITING 0x02 +#define CHILD_RESOLVING 0x03 + + +typedef struct { + char *ipstr; + int port; + struct passwd *pw; + char *chr; + char *pidfn; + void (*rcback)(int); +#if defined(DAEMON_UNIX_POOL) || defined(DAEMON_UNIX_MOBRULE) + int maxprocs, minprocs, proclife; +#endif +#ifdef NET_SSL + char *secure_keyfn; + char *secure_certfn; + char *secure_dongle; + int secure_auth; + int secure_session_timeout; + int security; +#endif +} daemon_s; + + +/* ------------------------------ Prototypes ------------------------------ */ + +#ifdef MCC_PROXY +/* A unique serial number assigned to each child. */ +extern int child_serial; +#endif + +/* + * daemon_run accepts whether or not it should detach from its parent process, + * and a daemon structure as its arguments. The daemon structure contains + * a port number, a root directory to chroot to (can be NULL), a filename to + * log the daemon pid to (can be NULL). daemon_run never returns. + * + * child_callback is a function which will be called every time a new + * connection is recieved. Session is a new session ID. + * + * rcback is a function which is a restart function: When SIGHUP is received, + * this function will be called. You may give SIG_DFL if you don't want to + * support restarting. The rcback will be passed SIGHUP. + * + * pw is the passwd entry to run the daemon as. If the effective user id is + * root, daemon_run will try to set its uid and gid to the user pointed + * to by this structure. You may pass NULL. + */ + +void daemon_run(int det, void (*child_callback)(Session *), daemon_s *d); + +/* + * fork is a wrapper for the system's fork function. This closes the listen + * socket for the mob. This also makes sure that a threaded daemon only gets + * the calling thread and not all of them. + */ + +pid_t child_fork(void); + + +/* + * Set status to the given code for statistics reporting + */ + +#ifdef DAEMON_STATS +void child_status(int code); +#else +#define child_status(code) (void)(code) +#endif + + +#endif +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/dll.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/dll.h new file mode 100644 index 00000000000..3b8a44d6c38 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/dll.h @@ -0,0 +1,124 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * dll.h: Handle dynamically linked libraries + * + * Rob McCool + */ + +#ifndef _DLL_H +#define _DLL_H + +#include "systems.h" + +#if defined(DLL_CAPABLE) + +/* --------------------------- Data structures ---------------------------- */ + + +#if defined(USE_NSPR) +#include <nspr/prlink.h> +typedef int DLHANDLE; + +#elif defined(DLL_DLOPEN) +#include <dlfcn.h> +typedef void *DLHANDLE; /* DLOPEN */ + +#elif defined(DLL_HPSHL) +#include <dl.h> +typedef shl_t DLHANDLE; /* HP_SHL */ + +#elif defined(DLL_WIN32) +typedef HINSTANCE DLHANDLE; /* WIN32 */ +#endif + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * dll_open loads the library at the given path into memory, and returns + * a handle to be used in later calls to dll_findsym and dll_close. + */ +#if defined(USE_NSPR) +#define dll_open(libfn) PR_LoadLibrary(libfn) + +#elif defined(DLL_DLOPEN) +#define dll_open(libfn) dlopen(libfn, DLL_DLOPEN_FLAGS) + +#elif defined(DLL_HPSHL) +#define dll_open(libfn) shl_load((libfn), BIND_IMMEDIATE, NULL) + +#elif defined(DLL_WIN32) +DLHANDLE dll_open(char *libfn); +#endif + + +/* + * dll_findsym looks for a symbol with the given name in the library + * pointed to by the given handle. Returns a pointer to the named function. + */ + +#if defined(USE_NSPR) +#define dll_findsym(dlp, name) PR_FindSymbol(name) + +#elif defined(DLL_DLOPEN) +#define dll_findsym(dlp, name) dlsym(dlp, name) + +#elif defined(DLL_HPSHL) +void *dll_findsym(DLHANDLE dlp, char *name); + +#elif defined(DLL_WIN32) +#define dll_findsym(dlp, name) GetProcAddress(dlp, name) +#endif + + +/* + * dll_error returns a string describing the last error on the given handle + */ +#if defined(USE_NSPR) +#define dll_error(dlp) system_errmsg(0) + +#elif defined(DLL_DLOPEN) +#define dll_error(dlp) dlerror() + +#elif defined(DLL_HPSHL) +#define dll_error(dlp) system_errmsg(0) + +#elif defined(DLL_WIN32) +#define dll_error(dlp) system_errmsg(0) +#endif + + +/* + * dll_close closes the previously opened library given by handle + */ +#if defined(USE_NSPR) +int dll_close(void *arg); + +#elif defined(DLL_DLOPEN) +#define dll_close dlclose + +#elif defined (DLL_HPSHL) +#define dll_close shl_unload + +#elif defined(DLL_WIN32) +#define dll_close FreeLibrary +#endif + + +#endif /* DLL_CAPABLE */ +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/ereport.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/ereport.h new file mode 100644 index 00000000000..b6ea5857e54 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/ereport.h @@ -0,0 +1,121 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * ereport.h: Records transactions, reports errors to administrators, etc. + * + * Rob McCool + */ + + +#ifndef EREPORT_H +#define EREPORT_H + + +#include "../base/session.h" /* Session structure */ +#ifdef XP_UNIX +#include <pwd.h> /* struct passwd */ +#endif /* XP_UNIX */ + + +/* ------------------------------ Constants ------------------------------- */ + + +/* + * The maximum length of an error message. NOT RUN-TIME CHECKED + */ + +#define MAX_ERROR_LEN 8192 + +/* A warning is a minor mishap, such as a 404 being issued. */ +#define LOG_WARN 0 + +/* + * A misconfig is when there is a syntax error or permission violation in + * a config. file. + */ +#define LOG_MISCONFIG 1 + +/* + * Security warnings are issued when authentication fails, or a host is + * given a 403 return code. + */ +#define LOG_SECURITY 2 + +/* + * A failure is when a request could not be fulfilled due to an internal + * problem, such as a CGI script exiting prematurely, or a filesystem + * permissions problem. + */ +#define LOG_FAILURE 3 + +/* + * A catastrophe is a fatal server error such as running out of + * memory or processes, or a system call failing, or even a server crash. + * The server child cannot recover from a catastrophe. + */ +#define LOG_CATASTROPHE 4 + +/* + * Informational message, of no concern. + */ +#define LOG_INFORM 5 + +/* + * The time format to use in the error log + */ + +#define ERR_TIMEFMT "[%d/%b/%Y:%H:%M:%S]" + + +/* The fd you will get if you are reporting errors to SYSLOG */ + +#define ERRORS_TO_SYSLOG -1 + + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * ereport logs an error of the given degree and formats the arguments with + * the printf() style fmt. Returns whether the log was successful. Records + * the current date. + */ + +int ereport(int degree, char *fmt, ...); + +/* + * ereport_init initializes the error logging subsystem and opens the static + * file descriptors. It returns NULL upon success and an error string upon + * error. If a userpw is given, the logs will be chowned to that user. + * + * email is the address of a person to mail upon catastrophic error. It + * can be NULL if no e-mail is desired. ereport_init will not duplicate + * its own copy of this string; you must make sure it stays around and free + * it when you shut down the server. + */ + +char *ereport_init(char *err_fn, char *email, struct passwd *pw); + +/* + * log_terminate closes the error and common log file descriptors. + */ +void ereport_terminate(void); + +/* For restarts */ +SYS_FILE ereport_getfd(void); + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/eventlog.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/eventlog.h new file mode 100644 index 00000000000..ef2a1e12842 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/eventlog.h @@ -0,0 +1,61 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +// EVENTLOG.H +// +// This file contains the defines that make NT an installable service. +// +// 1/12/95 aruna +// + +// Functions in eventlog.c +// Win32 specific stuff, so FUZZ: disable check_for_tchar + +VOID InitializeAdminLogging(PCHAR ServiceName, PCHAR MessageFile); +VOID InitializeHttpdLogging(PCHAR ServiceName, PCHAR MessageFile); +VOID InitializeHttpsLogging(PCHAR ServiceName, PCHAR MessageFile); + +VOID TerminateAdminLogging(); +VOID TerminateHttpdLogging(); +VOID TerminateHttpsLogging(); + +VOID LogErrorEvent(PCHAR ServiceName, WORD fwEventType, WORD fwCategory, DWORD IDEvent, + LPTSTR chMsg, LPTSTR lpszMsg); + +// Functions in error.c + +VOID ReportError(PCHAR ErrorMsg); + +BOOL CALLBACK ErrorDialogProc( + HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam + ); + + + + + + + + + + + + + + + diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/file.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/file.h new file mode 100644 index 00000000000..8c59a9f2be7 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/file.h @@ -0,0 +1,217 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * file.h: system specific functions for reading/writing files + * + * Rob McCool + */ + + +#ifndef FILE_H +#define FILE_H + +#ifdef XP_WIN32 +#include <nt/ntfile.h> +#else + + +#include "netsite.h" +#include "systems.h" + + +/* + * I cheat: These are set up such that system_read can be a macro for read + * under UNIX. IO_OKAY is anything positive. + */ + +#define IO_OKAY 1 +#define IO_ERROR -1 +#define IO_EOF 0 + + +#ifdef FILE_STDIO +#include <stdio.h> + +#elif defined(FILE_UNIX) +#include <sys/types.h> +#include <sys/file.h> +#include <fcntl.h> +#include <unistd.h> +#endif + + +/* -------------------------- File related defs --------------------------- */ + + +/* The disk page size on this machine. */ +#define FILE_BUFFERSIZE 4096 + + +/* + * The fd data type for this system. + */ + +#if defined(FILE_STDIO) +typedef FILE* SYS_FILE; +#define SYS_ERROR_FD NULL +#define SYS_STDERR stderr + +#elif defined(FILE_UNIX) +typedef int SYS_FILE; +#define SYS_ERROR_FD -1 +#define SYS_STDERR STDERR_FILENO + +#else +#error "undefined file typing for current system" +#endif + +#ifdef XP_UNIX +#define FILE_PATHSEP '/' +#define FILE_PARENT "../" + +#define system_chdir chdir +#endif + + +/* + * system_fread reads sz bytes from fd into to buf, return number of bytes + * read, or IO_EOF if EOF, or IO_ERROR if error. + */ + +#if defined(FILE_STDIO) +int system_fread(SYS_FILE fd, char *buf, int sz); + +#elif defined(FILE_UNIX) +#define system_fread(fd,buf,sz) read(fd,buf,sz) + +#endif + +/* + * system_fopenRO opens a given file for reading only + * system_fopenWA opens a given file for writing, appending new output + */ + +#if defined(FILE_STDIO) +#define system_fopenRO(path) fopen(path,"r") +#define system_fopenWA(path) fopen(path,"a") +#define system_fopenRW(path) fopen(path,"w") + +#elif defined(FILE_UNIX) +#define system_fopenRO(path) open(path, O_RDONLY) +#define system_fopenWA(path) \ + open(path, O_RDWR | O_CREAT | O_APPEND, 0644) +#define system_fopenRW(path) \ + open(path, O_RDWR | O_CREAT, 0644) + +#endif + + +/* + * system_fclose closes the file fd + */ + +#if defined(FILE_STDIO) +#define system_fclose(fd) fclose(fd) + +#elif defined(FILE_UNIX) +#define system_fclose(fd) close(fd) +#endif + +/* + * This call stops core dumps in a portable way. Returns -1 on error. + */ + +int system_nocoredumps(void); + + +#if defined(FILE_STDIO) +#define system_lseek fseek + +#elif defined(FILE_UNIX) +#define system_lseek lseek + +#endif + +/* + * system_write writes sz bytes from buf to fd. The handler function should + * handle partial writes and anything else like that. Returns IO_* + */ + +int system_fwrite(SYS_FILE fd,char *buf,int sz); + +/* + * system_fwrite_atomic locks the given fd before writing to it. This avoids + * interference between simultaneous writes. Returns IO_* + */ + +int system_fwrite_atomic(SYS_FILE fd, char *buf, int sz); + +/* + * system_errmsg returns the last error that occured while processing file + * descriptor fd. fd does not have to be specified (if the error is a global + * such as in UNIX systems). PPS: Rob is a halfwit. This parameter is useless. + */ + +#ifndef FILE_WIN32 +#include <errno.h> + +extern char *sys_errlist[]; +#define file_notfound() (errno == ENOENT) +#define system_errmsg(fd) (sys_errlist[errno]) +#endif + + +/* + * flock locks a file against interference from other processes + * ulock unlocks it. + */ +#ifdef BSD_FLOCK +#include <sys/file.h> +#define system_initlock(fd) (0) +#define system_flock(fd) flock(fd, LOCK_EX) +#define system_ulock(fd) flock(fd, LOCK_UN) + +#elif defined(FILE_UNIX) +#include <unistd.h> +#define system_initlock(fd) (0) +#define system_flock(fd) lockf(fd, F_LOCK, 0) +#define system_ulock(fd) lockf(fd, F_ULOCK, 0) + +#endif + + +/* + * unix2local converts a unix-style pathname to a local one + */ + +#ifdef XP_UNIX +#define file_unix2local(path,p2) strcpy(p2,path) +#endif + +/* -------------------------- Dir related defs ---------------------------- */ + + +#ifdef XP_UNIX +#include <dirent.h> +typedef DIR* SYS_DIR; +typedef struct dirent SYS_DIRENT; +#define dir_open opendir +#define dir_read readdir +#define dir_close closedir + +#endif +#endif +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/minissl.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/minissl.h new file mode 100644 index 00000000000..597e35a080e --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/minissl.h @@ -0,0 +1,27 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + + +/* Prototypes for SSL I/O functions */ +extern int SSL_Close(int); +extern int SSL_Socket(int, int, int); +extern int SSL_GetSockOpt(int, int, int, void *, int *); +extern int SSL_SetSockOpt(int, int, int, const void *, int); +extern int SSL_Bind(int, const void *, int); +extern int SSL_Listen(int, int); +extern int SSL_Accept(int, void *, int *); +extern int SSL_Read(int, void *, int); +extern int SSL_Write(int, const void *, int); +extern int SSL_GetPeerName(int, void *, int *); diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/net.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/net.h new file mode 100644 index 00000000000..44dfbdc68dc --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/net.h @@ -0,0 +1,180 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * net.h: system specific networking definitions + * + * Rob McCool + */ + + +#ifndef NET_H +#define NET_H + +#include "systems.h" + +#include "file.h" /* for client file descriptors */ + +#include "pblock.h" /* for client data block */ + + +/* This should be a user-given parameter later */ +#define NET_BUFFERSIZE 8192 +/* So should this. */ +#define NET_READ_TIMEOUT 120 +#define NET_WRITE_TIMEOUT 300 + +#define SSL_HANDSHAKE_TIMEOUT 300 + +#if defined(NET_SOCKETS) || defined(NET_SSL) + +#ifdef NET_WINSOCK +#include <winsock.h> +#else /* XP_UNIX */ +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> /* sockaddr and in_addr */ +#include <arpa/inet.h> /* inet_ntoa */ +#include <netdb.h> /* hostent stuff */ +#endif /* NET_WINSOCK */ + +#ifdef NET_SSL +#include "minissl.h" +#endif + + +/* -------------------------------- Global -------------------------------- */ + +extern int net_enabledns; + + + +/* ------------------------------ Data types ------------------------------ */ + + +#ifdef NET_WINSOCK +typedef SOCKET SYS_NETFD; +#else /* XP_UNIX */ +typedef int SYS_NETFD; +#endif /* NET_WINSOCK */ + +#define SYS_NET_ERRORFD -1 + + +/* -------------------------------- Macros -------------------------------- */ + + +/* These may be different for non-UNIX systems. */ + + +#ifndef NET_SSL +#define net_socket socket +#define net_setsockopt setsockopt +#define net_getsockopt getsockopt +#define net_listen listen +#define net_select select +#define net_getpeername getpeername + +#ifndef NET_WINSOCK +#define net_close(sd) close(sd) +#define net_bind bind +#else /* NET_WINSOCK */ +#define net_close(sd) closesocket(sd) +#define system_netbind bind +int net_bind(SYS_NETFD s, const struct sockaddr *name, int namelen); +#endif /* NET_WINSOCK */ + +#ifdef DAEMON_NEEDS_SEMAPHORE +#define net_accept net_semaccept +#else /* ! DAEMON_NEEDS_SEMAPHORE */ +#define net_accept accept +#endif /* DAEMON_NEEDS_SEMAPHORE */ + +#else /* NET_SSL */ +#define net_close(sd) SSL_Close(sd) +#define net_socket SSL_Socket +#define net_setsockopt SSL_SetSockOpt +#define net_getsockopt SSL_GetSockOpt + +#ifdef XP_UNIX +#define net_bind SSL_Bind +#else /* WIN32 */ +#define system_netbind SSL_Bind +int net_bind(SYS_NETFD s, const struct sockaddr *name, int namelen); +#endif /* XP_UNIX */ + +#define net_listen SSL_Listen +#define net_select select /* !!! */ +#define net_getpeername SSL_GetPeerName +#define net_accept SSL_Accept +#endif /* ! NET_SSL */ + + +/* Users should never call the system_net* functions. */ +#ifdef NET_SSL +#define system_netread(sd, buf, sz) SSL_Read(sd, buf, sz) +#define system_netwrite SSL_Write +#else /* ! NET_SSL */ + +#if !defined(NET_WINSOCK) +#define system_netread(sd, buf, sz) read(sd, buf, sz) +#define system_netwrite write +#else /* NET_WINSOCK */ +#define system_netread(sd, buf, sz) recv(sd, buf, sz, 0) +#define system_netwrite(sd, buf, sz) send(sd, buf, sz, 0) +#endif /* ! NET_WINSOCK */ + +#endif /* NET_SSL */ + +int net_read(SYS_NETFD sd, char *buf, int sz, int timeout); +int net_write(SYS_NETFD sd, char *buf, int sz); + +#ifdef DAEMON_NEEDS_SEMAPHORE +int net_semaccept_init(int port); +int net_semaccept(int s, struct sockaddr *addr, int *addrlen); +void net_semaccept_terminate(void); +#endif + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * net_find_fqdn looks through the given hostent structure trying to find + * a FQDN for the host. If it finds none, it returns NULL. Otherwise, it + * returns a newly allocated copy of that string. + */ + +char *net_find_fqdn(struct hostent *p); + +/* + * net_ip2host transforms the given textual IP number into a FQDN. If it + * can't find a FQDN, it will return what it can get. Otherwise, NULL. + * + * verify is whether or not the function should verify the hostname it + * gets. This takes an extra query but is safer for use in access control. + */ + +char *net_ip2host(char *ip, int verify); + +/* + * net_sendmail sends mail to the specified recipient with the given subject + * and message. Currently uses external programs. + */ + +int net_sendmail(char *to, char *subject, char *msg); + +#endif +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/nodelock.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/nodelock.h new file mode 100644 index 00000000000..619c1df2621 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/nodelock.h @@ -0,0 +1,47 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * nodelock.h: licensing stuff + */ + +#ifndef _NODELOCK_H +#define _NODELOCK_H + +/* + * Do the initial IP address check and expiration date check. Reads a file + * from admin/config, as #define'd. + * + * Returns 1 on error, 0 on AOK. + */ + +int node_init(void); + +/* + * Check the expiration date against The Now. + * + * Returns 1 on error, 0 on AOK. + */ + +int node_check(void); + +/* + * So how we doin, license + * + * Returns 1 on error, 0 on AOK + */ +int node_status(void); + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/nterrors.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/nterrors.h new file mode 100644 index 00000000000..19e9429558d --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/nterrors.h @@ -0,0 +1,738 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* DO NOT EDIT THIS FILE - it is automatically generated */ + +struct _NtError { + int ErrorNumber; + char *ErrorString; + struct _NtError *next; +} ; + +typedef struct _NtError NtError; + +NtError NtErrorStrings[] = { +{ 0 , "ERROR_SUCCESS" }, +{ 0 , "NO_ERROR" }, +{ 1 , "ERROR_INVALID_FUNCTION" }, +{ 2 , "ERROR_FILE_NOT_FOUND" }, +{ 3 , "ERROR_PATH_NOT_FOUND" }, +{ 4 , "ERROR_TOO_MANY_OPEN_FILES" }, +{ 5 , "ERROR_ACCESS_DENIED" }, +{ 6 , "ERROR_INVALID_HANDLE" }, +{ 7 , "ERROR_ARENA_TRASHED" }, +{ 8 , "ERROR_NOT_ENOUGH_MEMORY" }, +{ 9 , "ERROR_INVALID_BLOCK" }, +{ 10 , "ERROR_BAD_ENVIRONMENT" }, +{ 11 , "ERROR_BAD_FORMAT" }, +{ 12 , "ERROR_INVALID_ACCESS" }, +{ 13 , "ERROR_INVALID_DATA" }, +{ 14 , "ERROR_OUTOFMEMORY" }, +{ 15 , "ERROR_INVALID_DRIVE" }, +{ 16 , "ERROR_CURRENT_DIRECTORY" }, +{ 17 , "ERROR_NOT_SAME_DEVICE" }, +{ 18 , "ERROR_NO_MORE_FILES" }, +{ 19 , "ERROR_WRITE_PROTECT" }, +{ 20 , "ERROR_BAD_UNIT" }, +{ 21 , "ERROR_NOT_READY" }, +{ 22 , "ERROR_BAD_COMMAND" }, +{ 23 , "ERROR_CRC" }, +{ 24 , "ERROR_BAD_LENGTH" }, +{ 25 , "ERROR_SEEK" }, +{ 26 , "ERROR_NOT_DOS_DISK" }, +{ 27 , "ERROR_SECTOR_NOT_FOUND" }, +{ 28 , "ERROR_OUT_OF_PAPER" }, +{ 29 , "ERROR_WRITE_FAULT" }, +{ 30 , "ERROR_READ_FAULT" }, +{ 31 , "ERROR_GEN_FAILURE" }, +{ 32 , "ERROR_SHARING_VIOLATION" }, +{ 33 , "ERROR_LOCK_VIOLATION" }, +{ 34 , "ERROR_WRONG_DISK" }, +{ 36 , "ERROR_SHARING_BUFFER_EXCEEDED" }, +{ 38 , "ERROR_HANDLE_EOF" }, +{ 39 , "ERROR_HANDLE_DISK_FULL" }, +{ 50 , "ERROR_NOT_SUPPORTED" }, +{ 51 , "ERROR_REM_NOT_LIST" }, +{ 52 , "ERROR_DUP_NAME" }, +{ 53 , "ERROR_BAD_NETPATH" }, +{ 54 , "ERROR_NETWORK_BUSY" }, +{ 55 , "ERROR_DEV_NOT_EXIST" }, +{ 56 , "ERROR_TOO_MANY_CMDS" }, +{ 57 , "ERROR_ADAP_HDW_ERR" }, +{ 58 , "ERROR_BAD_NET_RESP" }, +{ 59 , "ERROR_UNEXP_NET_ERR" }, +{ 60 , "ERROR_BAD_REM_ADAP" }, +{ 61 , "ERROR_PRINTQ_FULL" }, +{ 62 , "ERROR_NO_SPOOL_SPACE" }, +{ 63 , "ERROR_PRINT_CANCELLED" }, +{ 64 , "ERROR_NETNAME_DELETED" }, +{ 65 , "ERROR_NETWORK_ACCESS_DENIED" }, +{ 66 , "ERROR_BAD_DEV_TYPE" }, +{ 67 , "ERROR_BAD_NET_NAME" }, +{ 68 , "ERROR_TOO_MANY_NAMES" }, +{ 69 , "ERROR_TOO_MANY_SESS" }, +{ 70 , "ERROR_SHARING_PAUSED" }, +{ 71 , "ERROR_REQ_NOT_ACCEP" }, +{ 72 , "ERROR_REDIR_PAUSED" }, +{ 80 , "ERROR_FILE_EXISTS" }, +{ 82 , "ERROR_CANNOT_MAKE" }, +{ 83 , "ERROR_FAIL_I24" }, +{ 84 , "ERROR_OUT_OF_STRUCTURES" }, +{ 85 , "ERROR_ALREADY_ASSIGNED" }, +{ 86 , "ERROR_INVALID_PASSWORD" }, +{ 87 , "ERROR_INVALID_PARAMETER" }, +{ 88 , "ERROR_NET_WRITE_FAULT" }, +{ 89 , "ERROR_NO_PROC_SLOTS" }, +{ 100 , "ERROR_TOO_MANY_SEMAPHORES" }, +{ 101 , "ERROR_EXCL_SEM_ALREADY_OWNED" }, +{ 102 , "ERROR_SEM_IS_SET" }, +{ 103 , "ERROR_TOO_MANY_SEM_REQUESTS" }, +{ 104 , "ERROR_INVALID_AT_INTERRUPT_TIME" }, +{ 105 , "ERROR_SEM_OWNER_DIED" }, +{ 106 , "ERROR_SEM_USER_LIMIT" }, +{ 107 , "ERROR_DISK_CHANGE" }, +{ 108 , "ERROR_DRIVE_LOCKED" }, +{ 109 , "ERROR_BROKEN_PIPE" }, +{ 110 , "ERROR_OPEN_FAILED" }, +{ 111 , "ERROR_BUFFER_OVERFLOW" }, +{ 112 , "ERROR_DISK_FULL" }, +{ 113 , "ERROR_NO_MORE_SEARCH_HANDLES" }, +{ 114 , "ERROR_INVALID_TARGET_HANDLE" }, +{ 117 , "ERROR_INVALID_CATEGORY" }, +{ 118 , "ERROR_INVALID_VERIFY_SWITCH" }, +{ 119 , "ERROR_BAD_DRIVER_LEVEL" }, +{ 120 , "ERROR_CALL_NOT_IMPLEMENTED" }, +{ 121 , "ERROR_SEM_TIMEOUT" }, +{ 122 , "ERROR_INSUFFICIENT_BUFFER" }, +{ 123 , "ERROR_INVALID_NAME" }, +{ 124 , "ERROR_INVALID_LEVEL" }, +{ 125 , "ERROR_NO_VOLUME_LABEL" }, +{ 126 , "ERROR_MOD_NOT_FOUND" }, +{ 127 , "ERROR_PROC_NOT_FOUND" }, +{ 128 , "ERROR_WAIT_NO_CHILDREN" }, +{ 129 , "ERROR_CHILD_NOT_COMPLETE" }, +{ 130 , "ERROR_DIRECT_ACCESS_HANDLE" }, +{ 131 , "ERROR_NEGATIVE_SEEK" }, +{ 132 , "ERROR_SEEK_ON_DEVICE" }, +{ 133 , "ERROR_IS_JOIN_TARGET" }, +{ 134 , "ERROR_IS_JOINED" }, +{ 135 , "ERROR_IS_SUBSTED" }, +{ 136 , "ERROR_NOT_JOINED" }, +{ 137 , "ERROR_NOT_SUBSTED" }, +{ 138 , "ERROR_JOIN_TO_JOIN" }, +{ 139 , "ERROR_SUBST_TO_SUBST" }, +{ 140 , "ERROR_JOIN_TO_SUBST" }, +{ 141 , "ERROR_SUBST_TO_JOIN" }, +{ 142 , "ERROR_BUSY_DRIVE" }, +{ 143 , "ERROR_SAME_DRIVE" }, +{ 144 , "ERROR_DIR_NOT_ROOT" }, +{ 145 , "ERROR_DIR_NOT_EMPTY" }, +{ 146 , "ERROR_IS_SUBST_PATH" }, +{ 147 , "ERROR_IS_JOIN_PATH" }, +{ 148 , "ERROR_PATH_BUSY" }, +{ 149 , "ERROR_IS_SUBST_TARGET" }, +{ 150 , "ERROR_SYSTEM_TRACE" }, +{ 151 , "ERROR_INVALID_EVENT_COUNT" }, +{ 152 , "ERROR_TOO_MANY_MUXWAITERS" }, +{ 153 , "ERROR_INVALID_LIST_FORMAT" }, +{ 154 , "ERROR_LABEL_TOO_LONG" }, +{ 155 , "ERROR_TOO_MANY_TCBS" }, +{ 156 , "ERROR_SIGNAL_REFUSED" }, +{ 157 , "ERROR_DISCARDED" }, +{ 158 , "ERROR_NOT_LOCKED" }, +{ 159 , "ERROR_BAD_THREADID_ADDR" }, +{ 160 , "ERROR_BAD_ARGUMENTS" }, +{ 161 , "ERROR_BAD_PATHNAME" }, +{ 162 , "ERROR_SIGNAL_PENDING" }, +{ 164 , "ERROR_MAX_THRDS_REACHED" }, +{ 167 , "ERROR_LOCK_FAILED" }, +{ 170 , "ERROR_BUSY" }, +{ 173 , "ERROR_CANCEL_VIOLATION" }, +{ 174 , "ERROR_ATOMIC_LOCKS_NOT_SUPPORTED" }, +{ 180 , "ERROR_INVALID_SEGMENT_NUMBER" }, +{ 182 , "ERROR_INVALID_ORDINAL" }, +{ 183 , "ERROR_ALREADY_EXISTS" }, +{ 186 , "ERROR_INVALID_FLAG_NUMBER" }, +{ 187 , "ERROR_SEM_NOT_FOUND" }, +{ 188 , "ERROR_INVALID_STARTING_CODESEG" }, +{ 189 , "ERROR_INVALID_STACKSEG" }, +{ 190 , "ERROR_INVALID_MODULETYPE" }, +{ 191 , "ERROR_INVALID_EXE_SIGNATURE" }, +{ 192 , "ERROR_EXE_MARKED_INVALID" }, +{ 193 , "ERROR_BAD_EXE_FORMAT" }, +{ 194 , "ERROR_ITERATED_DATA_EXCEEDS_64k" }, +{ 195 , "ERROR_INVALID_MINALLOCSIZE" }, +{ 196 , "ERROR_DYNLINK_FROM_INVALID_RING" }, +{ 197 , "ERROR_IOPL_NOT_ENABLED" }, +{ 198 , "ERROR_INVALID_SEGDPL" }, +{ 199 , "ERROR_AUTODATASEG_EXCEEDS_64k" }, +{ 200 , "ERROR_RING2SEG_MUST_BE_MOVABLE" }, +{ 201 , "ERROR_RELOC_CHAIN_XEEDS_SEGLIM" }, +{ 202 , "ERROR_INFLOOP_IN_RELOC_CHAIN" }, +{ 203 , "ERROR_ENVVAR_NOT_FOUND" }, +{ 205 , "ERROR_NO_SIGNAL_SENT" }, +{ 206 , "ERROR_FILENAME_EXCED_RANGE" }, +{ 207 , "ERROR_RING2_STACK_IN_USE" }, +{ 208 , "ERROR_META_EXPANSION_TOO_LONG" }, +{ 209 , "ERROR_INVALID_SIGNAL_NUMBER" }, +{ 210 , "ERROR_THREAD_1_INACTIVE" }, +{ 212 , "ERROR_LOCKED" }, +{ 214 , "ERROR_TOO_MANY_MODULES" }, +{ 215 , "ERROR_NESTING_NOT_ALLOWED" }, +{ 230 , "ERROR_BAD_PIPE" }, +{ 231 , "ERROR_PIPE_BUSY" }, +{ 232 , "ERROR_NO_DATA" }, +{ 233 , "ERROR_PIPE_NOT_CONNECTED" }, +{ 234 , "ERROR_MORE_DATA" }, +{ 240 , "ERROR_VC_DISCONNECTED" }, +{ 254 , "ERROR_INVALID_EA_NAME" }, +{ 255 , "ERROR_EA_LIST_INCONSISTENT" }, +{ 259 , "ERROR_NO_MORE_ITEMS" }, +{ 266 , "ERROR_CANNOT_COPY" }, +{ 267 , "ERROR_DIRECTORY" }, +{ 275 , "ERROR_EAS_DIDNT_FIT" }, +{ 276 , "ERROR_EA_FILE_CORRUPT" }, +{ 277 , "ERROR_EA_TABLE_FULL" }, +{ 278 , "ERROR_INVALID_EA_HANDLE" }, +{ 282 , "ERROR_EAS_NOT_SUPPORTED" }, +{ 288 , "ERROR_NOT_OWNER" }, +{ 298 , "ERROR_TOO_MANY_POSTS" }, +{ 299 , "ERROR_PARTIAL_COPY" }, +{ 317 , "ERROR_MR_MID_NOT_FOUND" }, +{ 487 , "ERROR_INVALID_ADDRESS" }, +{ 534 , "ERROR_ARITHMETIC_OVERFLOW" }, +{ 535 , "ERROR_PIPE_CONNECTED" }, +{ 536 , "ERROR_PIPE_LISTENING" }, +{ 994 , "ERROR_EA_ACCESS_DENIED" }, +{ 995 , "ERROR_OPERATION_ABORTED" }, +{ 996 , "ERROR_IO_INCOMPLETE" }, +{ 997 , "ERROR_IO_PENDING" }, +{ 998 , "ERROR_NOACCESS" }, +{ 999 , "ERROR_SWAPERROR" }, +{ 1001 , "ERROR_STACK_OVERFLOW" }, +{ 1002 , "ERROR_INVALID_MESSAGE" }, +{ 1003 , "ERROR_CAN_NOT_COMPLETE" }, +{ 1004 , "ERROR_INVALID_FLAGS" }, +{ 1005 , "ERROR_UNRECOGNIZED_VOLUME" }, +{ 1006 , "ERROR_FILE_INVALID" }, +{ 1007 , "ERROR_FULLSCREEN_MODE" }, +{ 1008 , "ERROR_NO_TOKEN" }, +{ 1009 , "ERROR_BADDB" }, +{ 1010 , "ERROR_BADKEY" }, +{ 1011 , "ERROR_CANTOPEN" }, +{ 1012 , "ERROR_CANTREAD" }, +{ 1013 , "ERROR_CANTWRITE" }, +{ 1014 , "ERROR_REGISTRY_RECOVERED" }, +{ 1015 , "ERROR_REGISTRY_CORRUPT" }, +{ 1016 , "ERROR_REGISTRY_IO_FAILED" }, +{ 1017 , "ERROR_NOT_REGISTRY_FILE" }, +{ 1018 , "ERROR_KEY_DELETED" }, +{ 1019 , "ERROR_NO_LOG_SPACE" }, +{ 1020 , "ERROR_KEY_HAS_CHILDREN" }, +{ 1021 , "ERROR_CHILD_MUST_BE_VOLATILE" }, +{ 1022 , "ERROR_NOTIFY_ENUM_DIR" }, +{ 1051 , "ERROR_DEPENDENT_SERVICES_RUNNING" }, +{ 1052 , "ERROR_INVALID_SERVICE_CONTROL" }, +{ 1053 , "ERROR_SERVICE_REQUEST_TIMEOUT" }, +{ 1054 , "ERROR_SERVICE_NO_THREAD" }, +{ 1055 , "ERROR_SERVICE_DATABASE_LOCKED" }, +{ 1056 , "ERROR_SERVICE_ALREADY_RUNNING" }, +{ 1057 , "ERROR_INVALID_SERVICE_ACCOUNT" }, +{ 1058 , "ERROR_SERVICE_DISABLED" }, +{ 1059 , "ERROR_CIRCULAR_DEPENDENCY" }, +{ 1060 , "ERROR_SERVICE_DOES_NOT_EXIST" }, +{ 1061 , "ERROR_SERVICE_CANNOT_ACCEPT_CTRL" }, +{ 1062 , "ERROR_SERVICE_NOT_ACTIVE" }, +{ 1063 , "ERROR_FAILED_SERVICE_CONTROLLER_CONNECT" }, +{ 1064 , "ERROR_EXCEPTION_IN_SERVICE" }, +{ 1065 , "ERROR_DATABASE_DOES_NOT_EXIST" }, +{ 1066 , "ERROR_SERVICE_SPECIFIC_ERROR" }, +{ 1067 , "ERROR_PROCESS_ABORTED" }, +{ 1068 , "ERROR_SERVICE_DEPENDENCY_FAIL" }, +{ 1069 , "ERROR_SERVICE_LOGON_FAILED" }, +{ 1070 , "ERROR_SERVICE_START_HANG" }, +{ 1071 , "ERROR_INVALID_SERVICE_LOCK" }, +{ 1072 , "ERROR_SERVICE_MARKED_FOR_DELETE" }, +{ 1073 , "ERROR_SERVICE_EXISTS" }, +{ 1074 , "ERROR_ALREADY_RUNNING_LKG" }, +{ 1075 , "ERROR_SERVICE_DEPENDENCY_DELETED" }, +{ 1076 , "ERROR_BOOT_ALREADY_ACCEPTED" }, +{ 1077 , "ERROR_SERVICE_NEVER_STARTED" }, +{ 1078 , "ERROR_DUPLICATE_SERVICE_NAME" }, +{ 1100 , "ERROR_END_OF_MEDIA" }, +{ 1101 , "ERROR_FILEMARK_DETECTED" }, +{ 1102 , "ERROR_BEGINNING_OF_MEDIA" }, +{ 1103 , "ERROR_SETMARK_DETECTED" }, +{ 1104 , "ERROR_NO_DATA_DETECTED" }, +{ 1105 , "ERROR_PARTITION_FAILURE" }, +{ 1106 , "ERROR_INVALID_BLOCK_LENGTH" }, +{ 1107 , "ERROR_DEVICE_NOT_PARTITIONED" }, +{ 1108 , "ERROR_UNABLE_TO_LOCK_MEDIA" }, +{ 1109 , "ERROR_UNABLE_TO_UNLOAD_MEDIA" }, +{ 1110 , "ERROR_MEDIA_CHANGED" }, +{ 1111 , "ERROR_BUS_RESET" }, +{ 1112 , "ERROR_NO_MEDIA_IN_DRIVE" }, +{ 1113 , "ERROR_NO_UNICODE_TRANSLATION" }, +{ 1114 , "ERROR_DLL_INIT_FAILED" }, +{ 1115 , "ERROR_SHUTDOWN_IN_PROGRESS" }, +{ 1116 , "ERROR_NO_SHUTDOWN_IN_PROGRESS" }, +{ 1117 , "ERROR_IO_DEVICE" }, +{ 1118 , "ERROR_SERIAL_NO_DEVICE" }, +{ 1119 , "ERROR_IRQ_BUSY" }, +{ 1120 , "ERROR_MORE_WRITES" }, +{ 1121 , "ERROR_COUNTER_TIMEOUT" }, +{ 1122 , "ERROR_FLOPPY_ID_MARK_NOT_FOUND" }, +{ 1123 , "ERROR_FLOPPY_WRONG_CYLINDER" }, +{ 1124 , "ERROR_FLOPPY_UNKNOWN_ERROR" }, +{ 1125 , "ERROR_FLOPPY_BAD_REGISTERS" }, +{ 1126 , "ERROR_DISK_RECALIBRATE_FAILED" }, +{ 1127 , "ERROR_DISK_OPERATION_FAILED" }, +{ 1128 , "ERROR_DISK_RESET_FAILED" }, +{ 1129 , "ERROR_EOM_OVERFLOW" }, +{ 1130 , "ERROR_NOT_ENOUGH_SERVER_MEMORY" }, +{ 1131 , "ERROR_POSSIBLE_DEADLOCK" }, +{ 1132 , "ERROR_MAPPED_ALIGNMENT" }, +{ 1140 , "ERROR_SET_POWER_STATE_VETOED" }, +{ 1141 , "ERROR_SET_POWER_STATE_FAILED" }, +{ 1150 , "ERROR_OLD_WIN_VERSION" }, +{ 1151 , "ERROR_APP_WRONG_OS" }, +{ 1152 , "ERROR_SINGLE_INSTANCE_APP" }, +{ 1153 , "ERROR_RMODE_APP" }, +{ 1154 , "ERROR_INVALID_DLL" }, +{ 1155 , "ERROR_NO_ASSOCIATION" }, +{ 1156 , "ERROR_DDE_FAIL" }, +{ 1157 , "ERROR_DLL_NOT_FOUND" }, +{ 2202 , "ERROR_BAD_USERNAME" }, +{ 2250 , "ERROR_NOT_CONNECTED" }, +{ 2401 , "ERROR_OPEN_FILES" }, +{ 2402 , "ERROR_ACTIVE_CONNECTIONS" }, +{ 2404 , "ERROR_DEVICE_IN_USE" }, +{ 1200 , "ERROR_BAD_DEVICE" }, +{ 1201 , "ERROR_CONNECTION_UNAVAIL" }, +{ 1202 , "ERROR_DEVICE_ALREADY_REMEMBERED" }, +{ 1203 , "ERROR_NO_NET_OR_BAD_PATH" }, +{ 1204 , "ERROR_BAD_PROVIDER" }, +{ 1205 , "ERROR_CANNOT_OPEN_PROFILE" }, +{ 1206 , "ERROR_BAD_PROFILE" }, +{ 1207 , "ERROR_NOT_CONTAINER" }, +{ 1208 , "ERROR_EXTENDED_ERROR" }, +{ 1209 , "ERROR_INVALID_GROUPNAME" }, +{ 1210 , "ERROR_INVALID_COMPUTERNAME" }, +{ 1211 , "ERROR_INVALID_EVENTNAME" }, +{ 1212 , "ERROR_INVALID_DOMAINNAME" }, +{ 1213 , "ERROR_INVALID_SERVICENAME" }, +{ 1214 , "ERROR_INVALID_NETNAME" }, +{ 1215 , "ERROR_INVALID_SHARENAME" }, +{ 1216 , "ERROR_INVALID_PASSWORDNAME" }, +{ 1217 , "ERROR_INVALID_MESSAGENAME" }, +{ 1218 , "ERROR_INVALID_MESSAGEDEST" }, +{ 1219 , "ERROR_SESSION_CREDENTIAL_CONFLICT" }, +{ 1220 , "ERROR_REMOTE_SESSION_LIMIT_EXCEEDED" }, +{ 1221 , "ERROR_DUP_DOMAINNAME" }, +{ 1222 , "ERROR_NO_NETWORK" }, +{ 1223 , "ERROR_CANCELLED" }, +{ 1224 , "ERROR_USER_MAPPED_FILE" }, +{ 1225 , "ERROR_CONNECTION_REFUSED" }, +{ 1226 , "ERROR_GRACEFUL_DISCONNECT" }, +{ 1227 , "ERROR_ADDRESS_ALREADY_ASSOCIATED" }, +{ 1228 , "ERROR_ADDRESS_NOT_ASSOCIATED" }, +{ 1229 , "ERROR_CONNECTION_INVALID" }, +{ 1230 , "ERROR_CONNECTION_ACTIVE" }, +{ 1231 , "ERROR_NETWORK_UNREACHABLE" }, +{ 1232 , "ERROR_HOST_UNREACHABLE" }, +{ 1233 , "ERROR_PROTOCOL_UNREACHABLE" }, +{ 1234 , "ERROR_PORT_UNREACHABLE" }, +{ 1235 , "ERROR_REQUEST_ABORTED" }, +{ 1236 , "ERROR_CONNECTION_ABORTED" }, +{ 1237 , "ERROR_RETRY" }, +{ 1238 , "ERROR_CONNECTION_COUNT_LIMIT" }, +{ 1239 , "ERROR_LOGIN_TIME_RESTRICTION" }, +{ 1240 , "ERROR_LOGIN_WKSTA_RESTRICTION" }, +{ 1241 , "ERROR_INCORRECT_ADDRESS" }, +{ 1242 , "ERROR_ALREADY_REGISTERED" }, +{ 1243 , "ERROR_SERVICE_NOT_FOUND" }, +{ 1244 , "ERROR_NOT_AUTHENTICATED" }, +{ 1245 , "ERROR_NOT_LOGGED_ON" }, +{ 1246 , "ERROR_CONTINUE" }, +{ 1247 , "ERROR_ALREADY_INITIALIZED" }, +{ 1248 , "ERROR_NO_MORE_DEVICES" }, +{ 1300 , "ERROR_NOT_ALL_ASSIGNED" }, +{ 1301 , "ERROR_SOME_NOT_MAPPED" }, +{ 1302 , "ERROR_NO_QUOTAS_FOR_ACCOUNT" }, +{ 1303 , "ERROR_LOCAL_USER_SESSION_KEY" }, +{ 1304 , "ERROR_NULL_LM_PASSWORD" }, +{ 1305 , "ERROR_UNKNOWN_REVISION" }, +{ 1306 , "ERROR_REVISION_MISMATCH" }, +{ 1307 , "ERROR_INVALID_OWNER" }, +{ 1308 , "ERROR_INVALID_PRIMARY_GROUP" }, +{ 1309 , "ERROR_NO_IMPERSONATION_TOKEN" }, +{ 1310 , "ERROR_CANT_DISABLE_MANDATORY" }, +{ 1311 , "ERROR_NO_LOGON_SERVERS" }, +{ 1312 , "ERROR_NO_SUCH_LOGON_SESSION" }, +{ 1313 , "ERROR_NO_SUCH_PRIVILEGE" }, +{ 1314 , "ERROR_PRIVILEGE_NOT_HELD" }, +{ 1315 , "ERROR_INVALID_ACCOUNT_NAME" }, +{ 1316 , "ERROR_USER_EXISTS" }, +{ 1317 , "ERROR_NO_SUCH_USER" }, +{ 1318 , "ERROR_GROUP_EXISTS" }, +{ 1319 , "ERROR_NO_SUCH_GROUP" }, +{ 1320 , "ERROR_MEMBER_IN_GROUP" }, +{ 1321 , "ERROR_MEMBER_NOT_IN_GROUP" }, +{ 1322 , "ERROR_LAST_ADMIN" }, +{ 1323 , "ERROR_WRONG_PASSWORD" }, +{ 1324 , "ERROR_ILL_FORMED_PASSWORD" }, +{ 1325 , "ERROR_PASSWORD_RESTRICTION" }, +{ 1326 , "ERROR_LOGON_FAILURE" }, +{ 1327 , "ERROR_ACCOUNT_RESTRICTION" }, +{ 1328 , "ERROR_INVALID_LOGON_HOURS" }, +{ 1329 , "ERROR_INVALID_WORKSTATION" }, +{ 1330 , "ERROR_PASSWORD_EXPIRED" }, +{ 1331 , "ERROR_ACCOUNT_DISABLED" }, +{ 1332 , "ERROR_NONE_MAPPED" }, +{ 1333 , "ERROR_TOO_MANY_LUIDS_REQUESTED" }, +{ 1334 , "ERROR_LUIDS_EXHAUSTED" }, +{ 1335 , "ERROR_INVALID_SUB_AUTHORITY" }, +{ 1336 , "ERROR_INVALID_ACL" }, +{ 1337 , "ERROR_INVALID_SID" }, +{ 1338 , "ERROR_INVALID_SECURITY_DESCR" }, +{ 1340 , "ERROR_BAD_INHERITANCE_ACL" }, +{ 1341 , "ERROR_SERVER_DISABLED" }, +{ 1342 , "ERROR_SERVER_NOT_DISABLED" }, +{ 1343 , "ERROR_INVALID_ID_AUTHORITY" }, +{ 1344 , "ERROR_ALLOTTED_SPACE_EXCEEDED" }, +{ 1345 , "ERROR_INVALID_GROUP_ATTRIBUTES" }, +{ 1346 , "ERROR_BAD_IMPERSONATION_LEVEL" }, +{ 1347 , "ERROR_CANT_OPEN_ANONYMOUS" }, +{ 1348 , "ERROR_BAD_VALIDATION_CLASS" }, +{ 1349 , "ERROR_BAD_TOKEN_TYPE" }, +{ 1350 , "ERROR_NO_SECURITY_ON_OBJECT" }, +{ 1351 , "ERROR_CANT_ACCESS_DOMAIN_INFO" }, +{ 1352 , "ERROR_INVALID_SERVER_STATE" }, +{ 1353 , "ERROR_INVALID_DOMAIN_STATE" }, +{ 1354 , "ERROR_INVALID_DOMAIN_ROLE" }, +{ 1355 , "ERROR_NO_SUCH_DOMAIN" }, +{ 1356 , "ERROR_DOMAIN_EXISTS" }, +{ 1357 , "ERROR_DOMAIN_LIMIT_EXCEEDED" }, +{ 1358 , "ERROR_INTERNAL_DB_CORRUPTION" }, +{ 1359 , "ERROR_INTERNAL_ERROR" }, +{ 1360 , "ERROR_GENERIC_NOT_MAPPED" }, +{ 1361 , "ERROR_BAD_DESCRIPTOR_FORMAT" }, +{ 1362 , "ERROR_NOT_LOGON_PROCESS" }, +{ 1363 , "ERROR_LOGON_SESSION_EXISTS" }, +{ 1364 , "ERROR_NO_SUCH_PACKAGE" }, +{ 1365 , "ERROR_BAD_LOGON_SESSION_STATE" }, +{ 1366 , "ERROR_LOGON_SESSION_COLLISION" }, +{ 1367 , "ERROR_INVALID_LOGON_TYPE" }, +{ 1368 , "ERROR_CANNOT_IMPERSONATE" }, +{ 1369 , "ERROR_RXACT_INVALID_STATE" }, +{ 1370 , "ERROR_RXACT_COMMIT_FAILURE" }, +{ 1371 , "ERROR_SPECIAL_ACCOUNT" }, +{ 1372 , "ERROR_SPECIAL_GROUP" }, +{ 1373 , "ERROR_SPECIAL_USER" }, +{ 1374 , "ERROR_MEMBERS_PRIMARY_GROUP" }, +{ 1375 , "ERROR_TOKEN_ALREADY_IN_USE" }, +{ 1376 , "ERROR_NO_SUCH_ALIAS" }, +{ 1377 , "ERROR_MEMBER_NOT_IN_ALIAS" }, +{ 1378 , "ERROR_MEMBER_IN_ALIAS" }, +{ 1379 , "ERROR_ALIAS_EXISTS" }, +{ 1380 , "ERROR_LOGON_NOT_GRANTED" }, +{ 1381 , "ERROR_TOO_MANY_SECRETS" }, +{ 1382 , "ERROR_SECRET_TOO_LONG" }, +{ 1383 , "ERROR_INTERNAL_DB_ERROR" }, +{ 1384 , "ERROR_TOO_MANY_CONTEXT_IDS" }, +{ 1385 , "ERROR_LOGON_TYPE_NOT_GRANTED" }, +{ 1386 , "ERROR_NT_CROSS_ENCRYPTION_REQUIRED" }, +{ 1387 , "ERROR_NO_SUCH_MEMBER" }, +{ 1388 , "ERROR_INVALID_MEMBER" }, +{ 1389 , "ERROR_TOO_MANY_SIDS" }, +{ 1390 , "ERROR_LM_CROSS_ENCRYPTION_REQUIRED" }, +{ 1391 , "ERROR_NO_INHERITANCE" }, +{ 1392 , "ERROR_FILE_CORRUPT" }, +{ 1393 , "ERROR_DISK_CORRUPT" }, +{ 1394 , "ERROR_NO_USER_SESSION_KEY" }, +{ 1395 , "ERROR_LICENSE_QUOTA_EXCEEDED" }, +{ 1400 , "ERROR_INVALID_WINDOW_HANDLE" }, +{ 1401 , "ERROR_INVALID_MENU_HANDLE" }, +{ 1402 , "ERROR_INVALID_CURSOR_HANDLE" }, +{ 1403 , "ERROR_INVALID_ACCEL_HANDLE" }, +{ 1404 , "ERROR_INVALID_HOOK_HANDLE" }, +{ 1405 , "ERROR_INVALID_DWP_HANDLE" }, +{ 1406 , "ERROR_TLW_WITH_WSCHILD" }, +{ 1407 , "ERROR_CANNOT_FIND_WND_CLASS" }, +{ 1408 , "ERROR_WINDOW_OF_OTHER_THREAD" }, +{ 1409 , "ERROR_HOTKEY_ALREADY_REGISTERED" }, +{ 1410 , "ERROR_CLASS_ALREADY_EXISTS" }, +{ 1411 , "ERROR_CLASS_DOES_NOT_EXIST" }, +{ 1412 , "ERROR_CLASS_HAS_WINDOWS" }, +{ 1413 , "ERROR_INVALID_INDEX" }, +{ 1414 , "ERROR_INVALID_ICON_HANDLE" }, +{ 1415 , "ERROR_PRIVATE_DIALOG_INDEX" }, +{ 1416 , "ERROR_LISTBOX_ID_NOT_FOUND" }, +{ 1417 , "ERROR_NO_WILDCARD_CHARACTERS" }, +{ 1418 , "ERROR_CLIPBOARD_NOT_OPEN" }, +{ 1419 , "ERROR_HOTKEY_NOT_REGISTERED" }, +{ 1420 , "ERROR_WINDOW_NOT_DIALOG" }, +{ 1421 , "ERROR_CONTROL_ID_NOT_FOUND" }, +{ 1422 , "ERROR_INVALID_COMBOBOX_MESSAGE" }, +{ 1423 , "ERROR_WINDOW_NOT_COMBOBOX" }, +{ 1424 , "ERROR_INVALID_EDIT_HEIGHT" }, +{ 1425 , "ERROR_DC_NOT_FOUND" }, +{ 1426 , "ERROR_INVALID_HOOK_FILTER" }, +{ 1427 , "ERROR_INVALID_FILTER_PROC" }, +{ 1428 , "ERROR_HOOK_NEEDS_HMOD" }, +{ 1429 , "ERROR_GLOBAL_ONLY_HOOK" }, +{ 1430 , "ERROR_JOURNAL_HOOK_SET" }, +{ 1431 , "ERROR_HOOK_NOT_INSTALLED" }, +{ 1432 , "ERROR_INVALID_LB_MESSAGE" }, +{ 1433 , "ERROR_SETCOUNT_ON_BAD_LB" }, +{ 1434 , "ERROR_LB_WITHOUT_TABSTOPS" }, +{ 1435 , "ERROR_DESTROY_OBJECT_OF_OTHER_THREAD" }, +{ 1436 , "ERROR_CHILD_WINDOW_MENU" }, +{ 1437 , "ERROR_NO_SYSTEM_MENU" }, +{ 1438 , "ERROR_INVALID_MSGBOX_STYLE" }, +{ 1439 , "ERROR_INVALID_SPI_VALUE" }, +{ 1440 , "ERROR_SCREEN_ALREADY_LOCKED" }, +{ 1441 , "ERROR_HWNDS_HAVE_DIFF_PARENT" }, +{ 1442 , "ERROR_NOT_CHILD_WINDOW" }, +{ 1443 , "ERROR_INVALID_GW_COMMAND" }, +{ 1444 , "ERROR_INVALID_THREAD_ID" }, +{ 1445 , "ERROR_NON_MDICHILD_WINDOW" }, +{ 1446 , "ERROR_POPUP_ALREADY_ACTIVE" }, +{ 1447 , "ERROR_NO_SCROLLBARS" }, +{ 1448 , "ERROR_INVALID_SCROLLBAR_RANGE" }, +{ 1449 , "ERROR_INVALID_SHOWWIN_COMMAND" }, +{ 1450 , "ERROR_NO_SYSTEM_RESOURCES" }, +{ 1451 , "ERROR_NONPAGED_SYSTEM_RESOURCES" }, +{ 1452 , "ERROR_PAGED_SYSTEM_RESOURCES" }, +{ 1453 , "ERROR_WORKING_SET_QUOTA" }, +{ 1454 , "ERROR_PAGEFILE_QUOTA" }, +{ 1455 , "ERROR_COMMITMENT_LIMIT" }, +{ 1456 , "ERROR_MENU_ITEM_NOT_FOUND" }, +{ 1500 , "ERROR_EVENTLOG_FILE_CORRUPT" }, +{ 1501 , "ERROR_EVENTLOG_CANT_START" }, +{ 1502 , "ERROR_LOG_FILE_FULL" }, +{ 1503 , "ERROR_EVENTLOG_FILE_CHANGED" }, +{ 1700 , "RPC_S_INVALID_STRING_BINDING" }, +{ 1701 , "RPC_S_WRONG_KIND_OF_BINDING" }, +{ 1702 , "RPC_S_INVALID_BINDING" }, +{ 1703 , "RPC_S_PROTSEQ_NOT_SUPPORTED" }, +{ 1704 , "RPC_S_INVALID_RPC_PROTSEQ" }, +{ 1705 , "RPC_S_INVALID_STRING_UUID" }, +{ 1706 , "RPC_S_INVALID_ENDPOINT_FORMAT" }, +{ 1707 , "RPC_S_INVALID_NET_ADDR" }, +{ 1708 , "RPC_S_NO_ENDPOINT_FOUND" }, +{ 1709 , "RPC_S_INVALID_TIMEOUT" }, +{ 1710 , "RPC_S_OBJECT_NOT_FOUND" }, +{ 1711 , "RPC_S_ALREADY_REGISTERED" }, +{ 1712 , "RPC_S_TYPE_ALREADY_REGISTERED" }, +{ 1713 , "RPC_S_ALREADY_LISTENING" }, +{ 1714 , "RPC_S_NO_PROTSEQS_REGISTERED" }, +{ 1715 , "RPC_S_NOT_LISTENING" }, +{ 1716 , "RPC_S_UNKNOWN_MGR_TYPE" }, +{ 1717 , "RPC_S_UNKNOWN_IF" }, +{ 1718 , "RPC_S_NO_BINDINGS" }, +{ 1719 , "RPC_S_NO_PROTSEQS" }, +{ 1720 , "RPC_S_CANT_CREATE_ENDPOINT" }, +{ 1721 , "RPC_S_OUT_OF_RESOURCES" }, +{ 1722 , "RPC_S_SERVER_UNAVAILABLE" }, +{ 1723 , "RPC_S_SERVER_TOO_BUSY" }, +{ 1724 , "RPC_S_INVALID_NETWORK_OPTIONS" }, +{ 1725 , "RPC_S_NO_CALL_ACTIVE" }, +{ 1726 , "RPC_S_CALL_FAILED" }, +{ 1727 , "RPC_S_CALL_FAILED_DNE" }, +{ 1728 , "RPC_S_PROTOCOL_ERROR" }, +{ 1730 , "RPC_S_UNSUPPORTED_TRANS_SYN" }, +{ 1732 , "RPC_S_UNSUPPORTED_TYPE" }, +{ 1733 , "RPC_S_INVALID_TAG" }, +{ 1734 , "RPC_S_INVALID_BOUND" }, +{ 1735 , "RPC_S_NO_ENTRY_NAME" }, +{ 1736 , "RPC_S_INVALID_NAME_SYNTAX" }, +{ 1737 , "RPC_S_UNSUPPORTED_NAME_SYNTAX" }, +{ 1739 , "RPC_S_UUID_NO_ADDRESS" }, +{ 1740 , "RPC_S_DUPLICATE_ENDPOINT" }, +{ 1741 , "RPC_S_UNKNOWN_AUTHN_TYPE" }, +{ 1742 , "RPC_S_MAX_CALLS_TOO_SMALL" }, +{ 1743 , "RPC_S_STRING_TOO_LONG" }, +{ 1744 , "RPC_S_PROTSEQ_NOT_FOUND" }, +{ 1745 , "RPC_S_PROCNUM_OUT_OF_RANGE" }, +{ 1746 , "RPC_S_BINDING_HAS_NO_AUTH" }, +{ 1747 , "RPC_S_UNKNOWN_AUTHN_SERVICE" }, +{ 1748 , "RPC_S_UNKNOWN_AUTHN_LEVEL" }, +{ 1749 , "RPC_S_INVALID_AUTH_IDENTITY" }, +{ 1750 , "RPC_S_UNKNOWN_AUTHZ_SERVICE" }, +{ 1751 , "EPT_S_INVALID_ENTRY" }, +{ 1752 , "EPT_S_CANT_PERFORM_OP" }, +{ 1753 , "EPT_S_NOT_REGISTERED" }, +{ 1754 , "RPC_S_NOTHING_TO_EXPORT" }, +{ 1755 , "RPC_S_INCOMPLETE_NAME" }, +{ 1756 , "RPC_S_INVALID_VERS_OPTION" }, +{ 1757 , "RPC_S_NO_MORE_MEMBERS" }, +{ 1758 , "RPC_S_NOT_ALL_OBJS_UNEXPORTED" }, +{ 1759 , "RPC_S_INTERFACE_NOT_FOUND" }, +{ 1760 , "RPC_S_ENTRY_ALREADY_EXISTS" }, +{ 1761 , "RPC_S_ENTRY_NOT_FOUND" }, +{ 1762 , "RPC_S_NAME_SERVICE_UNAVAILABLE" }, +{ 1763 , "RPC_S_INVALID_NAF_ID" }, +{ 1764 , "RPC_S_CANNOT_SUPPORT" }, +{ 1765 , "RPC_S_NO_CONTEXT_AVAILABLE" }, +{ 1766 , "RPC_S_INTERNAL_ERROR" }, +{ 1767 , "RPC_S_ZERO_DIVIDE" }, +{ 1768 , "RPC_S_ADDRESS_ERROR" }, +{ 1769 , "RPC_S_FP_DIV_ZERO" }, +{ 1770 , "RPC_S_FP_UNDERFLOW" }, +{ 1771 , "RPC_S_FP_OVERFLOW" }, +{ 1772 , "RPC_X_NO_MORE_ENTRIES" }, +{ 1773 , "RPC_X_SS_CHAR_TRANS_OPEN_FAIL" }, +{ 1774 , "RPC_X_SS_CHAR_TRANS_SHORT_FILE" }, +{ 1775 , "RPC_X_SS_IN_NULL_CONTEXT" }, +{ 1777 , "RPC_X_SS_CONTEXT_DAMAGED" }, +{ 1778 , "RPC_X_SS_HANDLES_MISMATCH" }, +{ 1779 , "RPC_X_SS_CANNOT_GET_CALL_HANDLE" }, +{ 1780 , "RPC_X_NULL_REF_POINTER" }, +{ 1781 , "RPC_X_ENUM_VALUE_OUT_OF_RANGE" }, +{ 1782 , "RPC_X_BYTE_COUNT_TOO_SMALL" }, +{ 1783 , "RPC_X_BAD_STUB_DATA" }, +{ 1784 , "ERROR_INVALID_USER_BUFFER" }, +{ 1785 , "ERROR_UNRECOGNIZED_MEDIA" }, +{ 1786 , "ERROR_NO_TRUST_LSA_SECRET" }, +{ 1787 , "ERROR_NO_TRUST_SAM_ACCOUNT" }, +{ 1788 , "ERROR_TRUSTED_DOMAIN_FAILURE" }, +{ 1789 , "ERROR_TRUSTED_RELATIONSHIP_FAILURE" }, +{ 1790 , "ERROR_TRUST_FAILURE" }, +{ 1791 , "RPC_S_CALL_IN_PROGRESS" }, +{ 1792 , "ERROR_NETLOGON_NOT_STARTED" }, +{ 1793 , "ERROR_ACCOUNT_EXPIRED" }, +{ 1794 , "ERROR_REDIRECTOR_HAS_OPEN_HANDLES" }, +{ 1795 , "ERROR_PRINTER_DRIVER_ALREADY_INSTALLED" }, +{ 1796 , "ERROR_UNKNOWN_PORT" }, +{ 1797 , "ERROR_UNKNOWN_PRINTER_DRIVER" }, +{ 1798 , "ERROR_UNKNOWN_PRINTPROCESSOR" }, +{ 1799 , "ERROR_INVALID_SEPARATOR_FILE" }, +{ 1800 , "ERROR_INVALID_PRIORITY" }, +{ 1801 , "ERROR_INVALID_PRINTER_NAME" }, +{ 1802 , "ERROR_PRINTER_ALREADY_EXISTS" }, +{ 1803 , "ERROR_INVALID_PRINTER_COMMAND" }, +{ 1804 , "ERROR_INVALID_DATATYPE" }, +{ 1805 , "ERROR_INVALID_ENVIRONMENT" }, +{ 1806 , "RPC_S_NO_MORE_BINDINGS" }, +{ 1807 , "ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT" }, +{ 1808 , "ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT" }, +{ 1809 , "ERROR_NOLOGON_SERVER_TRUST_ACCOUNT" }, +{ 1810 , "ERROR_DOMAIN_TRUST_INCONSISTENT" }, +{ 1811 , "ERROR_SERVER_HAS_OPEN_HANDLES" }, +{ 1812 , "ERROR_RESOURCE_DATA_NOT_FOUND" }, +{ 1813 , "ERROR_RESOURCE_TYPE_NOT_FOUND" }, +{ 1814 , "ERROR_RESOURCE_NAME_NOT_FOUND" }, +{ 1815 , "ERROR_RESOURCE_LANG_NOT_FOUND" }, +{ 1816 , "ERROR_NOT_ENOUGH_QUOTA" }, +{ 1817 , "RPC_S_NO_INTERFACES" }, +{ 1818 , "RPC_S_CALL_CANCELLED" }, +{ 1819 , "RPC_S_BINDING_INCOMPLETE" }, +{ 1820 , "RPC_S_COMM_FAILURE" }, +{ 1821 , "RPC_S_UNSUPPORTED_AUTHN_LEVEL" }, +{ 1822 , "RPC_S_NO_PRINC_NAME" }, +{ 1823 , "RPC_S_NOT_RPC_ERROR" }, +{ 1824 , "RPC_S_UUID_LOCAL_ONLY" }, +{ 1825 , "RPC_S_SEC_PKG_ERROR" }, +{ 1826 , "RPC_S_NOT_CANCELLED" }, +{ 1827 , "RPC_X_INVALID_ES_ACTION" }, +{ 1828 , "RPC_X_WRONG_ES_VERSION" }, +{ 1829 , "RPC_X_WRONG_STUB_VERSION" }, +{ 1898 , "RPC_S_GROUP_MEMBER_NOT_FOUND" }, +{ 1899 , "EPT_S_CANT_CREATE" }, +{ 1900 , "RPC_S_INVALID_OBJECT" }, +{ 1901 , "ERROR_INVALID_TIME" }, +{ 1902 , "ERROR_INVALID_FORM_NAME" }, +{ 1903 , "ERROR_INVALID_FORM_SIZE" }, +{ 1904 , "ERROR_ALREADY_WAITING" }, +{ 1905 , "ERROR_PRINTER_DELETED" }, +{ 1906 , "ERROR_INVALID_PRINTER_STATE" }, +{ 1907 , "ERROR_PASSWORD_MUST_CHANGE" }, +{ 1908 , "ERROR_DOMAIN_CONTROLLER_NOT_FOUND" }, +{ 1909 , "ERROR_ACCOUNT_LOCKED_OUT" }, +{ 6118 , "ERROR_NO_BROWSER_SERVERS_FOUND" }, +{ 2000 , "ERROR_INVALID_PIXEL_FORMAT" }, +{ 2001 , "ERROR_BAD_DRIVER" }, +{ 2002 , "ERROR_INVALID_WINDOW_STYLE" }, +{ 2003 , "ERROR_METAFILE_NOT_SUPPORTED" }, +{ 2004 , "ERROR_TRANSFORM_NOT_SUPPORTED" }, +{ 2005 , "ERROR_CLIPPING_NOT_SUPPORTED" }, +{ 3000 , "ERROR_UNKNOWN_PRINT_MONITOR" }, +{ 3001 , "ERROR_PRINTER_DRIVER_IN_USE" }, +{ 3002 , "ERROR_SPOOL_FILE_NOT_FOUND" }, +{ 3003 , "ERROR_SPL_NO_STARTDOC" }, +{ 3004 , "ERROR_SPL_NO_ADDJOB" }, +{ 3005 , "ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED" }, +{ 3006 , "ERROR_PRINT_MONITOR_ALREADY_INSTALLED" }, +{ 4000 , "ERROR_WINS_INTERNAL" }, +{ 4001 , "ERROR_CAN_NOT_DEL_LOCAL_WINS" }, +{ 4002 , "ERROR_STATIC_INIT" }, +{ 4003 , "ERROR_INC_BACKUP" }, +{ 4004 , "ERROR_FULL_BACKUP" }, +{ 4005 , "ERROR_REC_NON_EXISTENT" }, +{ 4006 , "ERROR_RPL_NOT_ALLOWED" }, +{ 10004 , "WSAEINTR" }, +{ 10009 , "WSAEBADF" }, +{ 10013 , "WSAEACCES" }, +{ 10014 , "WSAEFAULT" }, +{ 10022 , "WSAEINVAL" }, +{ 10024 , "WSAEMFILE" }, +{ 10035 , "WSAEWOULDBLOCK" }, +{ 10036 , "WSAEINPROGRESS" }, +{ 10037 , "WSAEALREADY" }, +{ 10038 , "WSAENOTSOCK" }, +{ 10039 , "WSAEDESTADDRREQ" }, +{ 10040 , "WSAEMSGSIZE" }, +{ 10041 , "WSAEPROTOTYPE" }, +{ 10042 , "WSAENOPROTOOPT" }, +{ 10043 , "WSAEPROTONOSUPPORT" }, +{ 10044 , "WSAESOCKTNOSUPPORT" }, +{ 10045 , "WSAEOPNOTSUPP" }, +{ 10046 , "WSAEPFNOSUPPORT" }, +{ 10047 , "WSAEAFNOSUPPORT" }, +{ 10048 , "WSAEADDRINUSE" }, +{ 10049 , "WSAEADDRNOTAVAIL" }, +{ 10050 , "WSAENETDOWN" }, +{ 10051 , "WSAENETUNREACH" }, +{ 10052 , "WSAENETRESET" }, +{ 10053 , "WSAECONNABORTED" }, +{ 10054 , "WSAECONNRESET" }, +{ 10055 , "WSAENOBUFS" }, +{ 10056 , "WSAEISCONN" }, +{ 10057 , "WSAENOTCONN" }, +{ 10058 , "WSAESHUTDOWN" }, +{ 10059 , "WSAETOOMANYREFS" }, +{ 10060 , "WSAETIMEDOUT" }, +{ 10061 , "WSAECONNREFUSED" }, +{ 10062 , "WSAELOOP" }, +{ 10063 , "WSAENAMETOOLONG" }, +{ 10064 , "WSAEHOSTDOWN" }, +{ 10065 , "WSAEHOSTUNREACH" }, +{ 10066 , "WSAENOTEMPTY" }, +{ 10067 , "WSAEPROCLIM" }, +{ 10068 , "WSAEUSERS" }, +{ 10069 , "WSAEDQUOT" }, +{ 10070 , "WSAESTALE" }, +{ 10071 , "WSAEREMOTE" }, +{ 10101 , "WSAEDISCON" }, +{ 10091 , "WSASYSNOTREADY" }, +{ 10092 , "WSAVERNOTSUPPORTED" }, +{ 10093 , "WSANOTINITIALISED" }, +{ 11001 , "WSAHOST_NOT_FOUND" }, +{ 11002 , "WSATRY_AGAIN" }, +{ 11003 , "WSANO_RECOVERY" }, +{ 11004 , "WSANO_DATA" }, +{ 0, NULL } +}; diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/objndx.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/objndx.h new file mode 100644 index 00000000000..ceb6d06b133 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/objndx.h @@ -0,0 +1,29 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +#ifndef __objndx_h +#define __objndx_h + +/* Define maximum length of object name strings */ +#define OBJNDXNAMLEN 16 + +/* Functions in objndx.c */ +extern void * objndx_create(int size, void (*freefunc)(void *)); +extern char * objndx_register(void * objndx, void * objptr, char * namebuf); +extern void * objndx_lookup(void * objndx, char * objname); +extern void * objndx_remove(void * objndx, char * objname); +extern void objndx_destroy(void * objndx); + +#endif /* __objndx_h */ diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/pblock.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/pblock.h new file mode 100644 index 00000000000..4dc1629fcd0 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/pblock.h @@ -0,0 +1,193 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * pblock.h: Header for Parameter Block handling functions + * + * + * A parameter block is a set of name=value pairs which are generally used + * as parameters, but can be anything. They are kept in a hash table for + * reasonable speed, but if you are doing any intensive modification or + * access of them you should probably make a local copy of each parameter + * while working. + * + * When creating a pblock, you specify the hash table size for that pblock. + * You should set this size larger if you know that many items will be in + * that pblock, and smaller if only a few will be used or if speed is not + * a concern. + * + * The hashing function is very simple right now, and only looks at the + * first character of name. + * + * Rob McCool + * + */ + +#ifndef PBLOCK_H +#define PBLOCK_H + +/* + * Requires that the macros MALLOC and STRDUP be set to "safe" versions that + * will exit if no memory is available. If not under MCC httpd, define + * them to be the real functions and play with fire, or make your own + * function. + */ + +#include "../netsite.h" + +#include <ctype.h> /* isspace */ +#include <stdio.h> /* sprintf */ +#include <string.h> /* strlen, strcmp */ + + +/* ------------------------------ Structures ------------------------------ */ + + +typedef struct { + char *name,*value; +} pb_param; + +struct pb_entry { + pb_param *param; + struct pb_entry *next; +}; + +typedef struct { + int hsize; + struct pb_entry **ht; +} pblock; + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * param_create creates a parameter with the given name and value. If name + * and value are non-NULL, they are copied and placed into the new pb_param + * struct. + */ + +pb_param *param_create(char *name, char *value); + +/* + * param_free frees a given parameter if it's non-NULL, and returns 1 if + * p was non-NULL, and 0 if p was NULL. + * + * Useful for error checking pblock_remove. + */ + +int param_free(pb_param *pp); + +/* + * pblock_create creates a new pblock with hash table size n. + * + * It returns the newly allocated pblock. + */ + +pblock *pblock_create(int n); + +/* + * pblock_free frees the given pblock and any entries inside it. + * + * If you want to save anything in a pblock, remove its entities with + * pblock_remove first and save the pointers you get. + */ + +void pblock_free(pblock *pb); + +/* + * pblock_find finds the entry with the given name in pblock pb. + * + * If it is successful, it returns the param block. If not, it returns NULL. + */ + +#define pblock_find(name, pb) (_pblock_fr(name,pb,0)) + +/* + * pblock_findval finds the entry with the given name in pblock pb, and + * returns its value, otherwise returns NULL. + */ + +char *pblock_findval(char *name, pblock *pb); + +/* + * pblock_remove behaves exactly like pblock_find, but removes the given + * entry from pb. + */ + +#define pblock_remove(name, pb) (_pblock_fr(name,pb,1)) + +/* + * pblock_nvinsert creates a new parameter with the given name and value + * and inserts it into pblock pb. The name and value in the parameter are + * also newly allocated. Returns the pb_param it allocated (in case you + * need it). + * + * pblock_nninsert inserts a numerical value. + */ + +pb_param *pblock_nvinsert(char *name, char *value, pblock *pb); +pb_param *pblock_nninsert(char *name, int value, pblock *pb); + +/* + * pblock_pinsert inserts a pb_param into a pblock. + */ + +void pblock_pinsert(pb_param *pp, pblock *pb); + +/* + * pblock_str2pblock scans the given string str for parameter pairs + * name=value, or name="value". Any \ must be followed by a literal + * character. If a string value is found, with no unescaped = signs, it + * will be added with the name 1, 2, 3, etc. depending on whether it was + * first, second, third, etc. in the stream (zero doesn't count). + * + * Returns the number of parameters added to the table, or -1 upon error. + */ + +int pblock_str2pblock(char *str, pblock *pb); + +/* + * pblock_pblock2str places all of the parameters in the given pblock + * into the given string (NULL if it needs creation). It will re-allocate + * more space for the string. Each parameter is separated by a space and of + * the form name="value" + */ + +char *pblock_pblock2str(pblock *pb, char *str); + +/* + * pblock_copy copies the entries in the given source pblock to the + * destination one. The entries are newly allocated so that the original + * pblock may be freed or the new one changed without affecting the other. + */ + +void pblock_copy(pblock *src, pblock *dst); + +/* + * pblock_pb2env copies the given pblock into the given environment, with + * one new env entry for each name/value pair in the pblock. + */ + +char **pblock_pb2env(pblock *pb, char **env); + + +/* --------------------------- Internal things ---------------------------- */ + + +pb_param *_pblock_fr(char *name, pblock *pb, int remove); + + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/sem.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/sem.h new file mode 100644 index 00000000000..da88b41da15 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/sem.h @@ -0,0 +1,70 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * sem.h: Attempt to provide multi-process semaphores across platforms + * + * Rob McCool + */ + + +#ifndef SEM_H +#define SEM_H + +#include "systems.h" + + +/* All of the implementations currently use int as the semaphore type */ +#ifdef SEM_WIN32 +typedef HANDLE SEMAPHORE; +#define SEM_ERROR NULL +/* That oughta hold them (I hope) */ +#define SEM_MAXVALUE 32767 + +#else /* ! SEM_WIN32 */ +typedef int SEMAPHORE; +#define SEM_ERROR -1 +#endif /* SEM_WIN32 */ + +/* + * sem_init creates a semaphore using the given name and unique + * identification number. filename should be a file accessible to the + * process. Returns SEM_ERROR on error. + */ + +SEMAPHORE sem_init(char *name, int number); + +/* + * sem_terminate de-allocates the given semaphore. + */ + +void sem_terminate(SEMAPHORE id); + +/* + * sem_grab attempts to gain exclusive access to the given semaphore. If + * it can't get it, the caller will block. Returns -1 on error. + */ + +int sem_grab(SEMAPHORE id); + +/* + * sem_release releases this process's exclusive control over the given + * semaphore. Returns -1 on error. + */ + +int sem_release(SEMAPHORE id); + + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/session.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/session.h new file mode 100644 index 00000000000..3104cb0ca65 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/session.h @@ -0,0 +1,85 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * session.h: Deals with virtual sessions + * + * A session is the time between when a client connects and when it + * disconnects. Several requests may be handled in one session. + * + * Rob McCool + */ + + +#ifndef SESSION_H +#define SESSION_H + + +#include "../netsite.h" /* MALLOC etc */ +#include "net.h" /* dns-related stuff */ +#include "buffer.h" /* netbuf */ + + +/* ------------------------------ Structures ------------------------------ */ + + + +#define SESSION_HASHSIZE 5 + + +typedef struct { + /* Client-specific information */ + pblock *client; + + SYS_NETFD csd; + netbuf *inbuf; + + struct in_addr iaddr; +} Session; + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * session_create creates a new request structure for the client with the + * given socket descriptor and sockaddr. + */ + +Session *session_create(SYS_NETFD csd, struct sockaddr_in *sac); + +/* + * session_free frees the given session + */ + +void session_free(Session *sn); + +/* + * session_dns returns the DNS hostname of the client of this session, + * and inserts it into the client pblock. Returns NULL if unavailable. + */ + +#define session_dns(sn) session_dns_lookup(sn, 0) + +/* + * session_maxdns looks up a hostname from an IP address, and then verifies + * that the host is really who they claim to be. + */ + +#define session_maxdns(sn) session_dns_lookup(sn, 1) + +char *session_dns_lookup(Session *sn, int verify); + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/shexp.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/shexp.h new file mode 100644 index 00000000000..887f96ae81e --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/shexp.h @@ -0,0 +1,97 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * shexp.h: Defines and prototypes for shell exp. match routines + * + * + * This routine will match a string with a shell expression. The expressions + * accepted are based loosely on the expressions accepted by zsh. + * + * o * matches anything + * o ? matches one character + * o \ will escape a special character + * o $ matches the end of the string + * o [abc] matches one occurence of a, b, or c. The only character that needs + * to be escaped in this is ], all others are not special. + * o [a-z] matches any character between a and z + * o [^az] matches any character except a or z + * o ~ followed by another shell expression will remove any pattern + * matching the shell expression from the match list + * o (foo|bar) will match either the substring foo, or the substring bar. + * These can be shell expressions as well. + * + * The public interface to these routines is documented below. + * + * Rob McCool + * + */ + +#ifndef SHEXP_H +#define SHEXP_H + +/* + * Requires that the macro MALLOC be set to a "safe" malloc that will + * exit if no memory is available. If not under MCC httpd, define MALLOC + * to be the real malloc and play with fire, or make your own function. + */ + +#include "../netsite.h" + +#include <ctype.h> /* isalnum */ +#include <string.h> /* strlen */ + + + +/* --------------------------- Public routines ---------------------------- */ + + +/* + * shexp_valid takes a shell expression exp as input. It returns: + * + * NON_SXP if exp is a standard string + * INVALID_SXP if exp is a shell expression, but invalid + * VALID_SXP if exp is a valid shell expression + */ + +#define NON_SXP -1 +#define INVALID_SXP -2 +#define VALID_SXP 1 + +int shexp_valid(char *exp); + +/* + * shexp_match + * + * Takes a prevalidated shell expression exp, and a string str. + * + * Returns 0 on match and 1 on non-match. + */ + +int shexp_match(char *str, char *exp); + + +/* + * shexp_cmp + * + * Same as above, but validates the exp first. 0 on match, 1 on non-match, + * -1 on invalid exp. shexp_casecmp does the same thing but is case + * insensitive. + */ + +int shexp_cmp(char *str, char *exp); +int shexp_casecmp(char *str, char *exp); + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/shmem.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/shmem.h new file mode 100644 index 00000000000..0692a051c78 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/shmem.h @@ -0,0 +1,84 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * shmem.h: Portable abstraction for memory shared among a server's workers + * + * Rob McCool + */ + + +#ifndef _SHMEM_H +#define _SHMEM_H + +#include "netsite.h" +#include "systems.h" + + +/* --------------------------- Data structures ---------------------------- */ + + +#if defined (SHMEM_UNIX_MMAP) || defined (SHMEM_WIN32_MMAP) +#include "file.h" /* SYS_FILE */ + +typedef struct { + void *data; /* the data */ +#ifdef SHMEM_WIN32_MMAP + HANDLE fdmap; +#endif /* SHMEM_WIN32_MMAP */ + int size; /* the maximum length of the data */ + + char *name; /* internal use: filename to unlink if exposed */ + SYS_FILE fd; /* internal use: file descriptor for region */ +} shmem_s; + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * shmem_alloc allocates a region of shared memory of the given size, using + * the given name to avoid conflicts between multiple regions within the + * program. The region will not be automatically grown if its boundaries + * are over-run, use shmem_realloc for that. + * + * If expose is non-zero and the underlying system supports it, the + * file used to create the shared region will be visible to other processes + * running on the system. + * + * name should be unique to the program which calls this routine, otherwise + * conflicts will arise. + * + * Returns a new shared memory region, with the data element being a + * pointer to the shared memory. This function must be called before any + * daemon workers are spawned, in order for the handle to the shared region + * to be inherited by the children. + * + * Because of the requirement that the region must be inherited by the + * children, the region cannot be re-allocated with a larger size when + * necessary. + */ +shmem_s *shmem_alloc(char *name, int size, int expose); + + +/* + * shmem_free de-allocates the specified region of shared memory. + */ +void shmem_free(shmem_s *region); + +#endif /* SHMEM_UNIX_MMAP || SHMEM_WIN32_MMAP */ + + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/systems.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/systems.h new file mode 100644 index 00000000000..193bc63c034 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/systems.h @@ -0,0 +1,222 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * systems.h: Lists of defines for systems + * + * This sets what general flavor the system is (UNIX, etc.), + * and defines what extra functions your particular system needs. + */ + + +#ifndef SYSTEMS_H +#define SYSTEMS_H + +#include <string.h> + + +#define DAEMON_ANY +#define DAEMON_LISTEN_SIZE 128 +#ifndef MCC_ADMSERV +#define DAEMON_STATS +#endif + +/* Linux is not currently supported */ +#ifdef linux + +#define FILE_UNIX +#undef FILE_STDIO +#undef DAEMON_UNIX_FORK +#undef DAEMON_UNIX_POOL +#define DAEMON_UNIX_MOBRULE +#undef DAEMON_STATS +#define BSD_FLOCK +#define BSD_RLIMIT +#define NET_SOCKETS +#define FILE_UNIX_MMAP +#define FILE_MMAP_FLAGS (MAP_FILE | MAP_PRIVATE) +#undef BSD_SIGNALS + +#undef NEED_CRYPT_PROTO +#undef AUTH_DBM +#define SEM_FLOCK + + +#define ZERO(ptr,len) memset(ptr,0,len) + +#elif defined(BSDI) + +#define FILE_UNIX +#define DAEMON_UNIX_MOBRULE +#define BSD_FLOCK +#define BSD_RLIMIT +#define NET_SOCKETS +#define FILE_UNIX_MMAP +#define FILE_MMAP_FLAGS (MAP_FILE | MAP_PRIVATE) +#define BSD_SIGNALS +#define BSD_TIME +#define BSD_MAIL +#undef NEED_CRYPT_PROTO +#define AUTH_DBM +#define SEM_FLOCK + +#define ZERO(ptr,len) memset(ptr,0,len) + +#elif defined(SOLARIS) + +#define FILE_UNIX +#undef FILE_STDIO +#define DAEMON_UNIX_MOBRULE +#define DAEMON_NEEDS_SEMAPHORE +#define NET_SOCKETS +#define FILE_UNIX_MMAP +#define FILE_MMAP_FLAGS MAP_PRIVATE +#undef BSD_SIGNALS +#define BSD_RLIMIT +#define NEED_CRYPT_H +#define AUTH_DBM +/* The Solaris routines return ENOSPC when too many semaphores are SEM_UNDO. */ +#define SEM_FLOCK +#define DLL_CAPABLE +#define DLL_DLOPEN + +#define ZERO(ptr,len) memset(ptr,0,len) + +#elif defined(SUNOS4) + +#define BSD_SIGNALS +#define BSD_TIME +#define BSD_MAIL +#define BSD_FLOCK +#define BSD_RLIMIT +#define FILE_UNIX +#undef FILE_STDIO +#define DAEMON_UNIX_MOBRULE +#define NET_SOCKETS +#define FILE_UNIX_MMAP +#define FILE_MMAP_FLAGS MAP_PRIVATE +#undef NEED_CRYPT_H +#define NEED_CRYPT_PROTO +#define AUTH_DBM +#define SEM_FLOCK +#define ZERO(ptr,len) memset(ptr,0,len) +#define DLL_CAPABLE +#define DLL_DLOPEN + +#elif defined(OSF1) + +#undef BSD_SIGNALS +#define BSD_TIME +#define BSD_FLOCK +#define BSD_RLIMIT +#define FILE_UNIX +#undef FILE_STDIO +#define DAEMON_UNIX_MOBRULE +#define DAEMON_NEEDS_SEMAPHORE +#define NET_SOCKETS +#define FILE_UNIX_MMAP +#define FILE_MMAP_FLAGS MAP_PRIVATE +#define AUTH_DBM +#define SEM_FLOCK +#define ZERO(ptr,len) memset(ptr,0,len) +#define DLL_CAPABLE +#define DLL_DLOPEN + +#elif defined(AIX) + +#define FILE_UNIX +#undef FILE_STDIO +#undef DAEMON_UNIX_FORK +#undef DAEMON_UNIX_POOL +#define DAEMON_UNIX_MOBRULE +#define DAEMON_NEEDS_SEMAPHORE +#define NET_SOCKETS +#define FILE_UNIX_MMAP +#define FILE_MMAP_FLAGS MAP_PRIVATE +#undef BSD_SIGNALS +#define BSD_RLIMIT +#undef NEED_CRYPT_H +#define AUTH_DBM +#define SEM_FLOCK +#define ZERO(ptr,len) memset(ptr,0,len) +#define DLL_CAPABLE +#define DLL_DLOPEN + +#elif defined(HPUX) + +#define FILE_UNIX +#undef FILE_STDIO +#define DAEMON_UNIX_MOBRULE +#define DAEMON_NEEDS_SEMAPHORE +#define NET_SOCKETS +#define FILE_UNIX_MMAP +#define FILE_MMAP_FLAGS MAP_PRIVATE +#undef BSD_SIGNALS +#undef BSD_RLIMIT +#undef NEED_CRYPT_H +#define AUTH_DBM +#define SEM_FLOCK +#define ZERO(ptr,len) memset(ptr,0,len) +#define DLL_CAPABLE +#define DLL_HPSHL + +#elif defined (IRIX) + +#define FILE_UNIX +#undef FILE_STDIO +#undef DAEMON_UNIX_FORK +#undef DAEMON_UNIX_POOL +#define DAEMON_UNIX_MOBRULE +#define DLL_CAPABLE +#define DLL_DLOPEN +#define NET_SOCKETS +#define FILE_UNIX_MMAP +#define FILE_MMAP_FLAGS MAP_PRIVATE +#undef BSD_SIGNALS +#define BSD_RLIMIT +#define NEED_CRYPT_H +#define AUTH_DBM +#define SEM_FLOCK +#define ZERO(ptr,len) memset(ptr,0,len) + +#else /* Windows NT */ + +#include <wtypes.h> +#include <winbase.h> + +typedef void* PASSWD; + +#define FILE_WIN32 +#define NET_SOCKETS +#define NET_WINSOCK +#define DAEMON_WIN32 +#undef AUTH_DBM +#define ZERO(ptr, len) ZeroMemory(ptr, len) +#define SEM_WIN32 +#define DLL_CAPABLE +#define DLL_WIN32 +#define NO_NODELOCK /* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaagh */ + +/* The stat call under NT doesn't define these macros */ +#define S_ISDIR(mode) ((mode&S_IFMT) == S_IFDIR) +#define S_ISREG(mode) ((mode&S_IFMT) == S_IFREG) + +#define strcasecmp util_strcasecmp +#define strncasecmp util_strncasecmp +int util_strcasecmp(const char *s1, const char *s2); +int util_strncasecmp(const char *s1, const char *s2, int n); +#endif /* Windows NT */ + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/systhr.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/systhr.h new file mode 100644 index 00000000000..e53cc385049 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/systhr.h @@ -0,0 +1,130 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * systhr.h: Abstracted threading mechanisms + * + * Rob McCool + */ + +#ifndef _SYSTHR_H +#define _SYSTHR_H + +#include "netsite.h" +#include "systems.h" + +#ifdef THREAD_ANY + +#ifdef USE_NSPR +#include <nspr/prthread.h> +#include <nspr/prglobal.h> + +typedef PRThread* SYS_THREAD; +#endif + +#ifdef THREAD_WIN32 +#include <nspr/prthread.h> +#include <nspr/prglobal.h> +#include <process.h> +typedef struct { + HANDLE hand; + DWORD id; +} sys_thread_s; +typedef sys_thread_s *SYS_THREAD; +#endif + +/* + * systhread_start creates a thread with the given priority, will allocate + * a stack of stksz bytes, and calls fn with arg as its argument. stksz + * of zero will allocate a default stack size. + * + * XXX Priorities are system dependent + */ + +SYS_THREAD systhread_start(int prio, int stksz, void (*fn)(void *), void *arg); + +/* + * systhread_current returns a pointer to the current thread. + */ +#ifdef USE_NSPR +#define systhread_current() PR_CurrentThread() +#elif defined(THREAD_WIN32) +#define systhread_current() GetCurrentThreadId() +#endif + +/* + * systhread_attach makes an existing thread an NSPR thread. Currently this + * is used only in NT. + */ + +SYS_THREAD systhread_attach(); + +/* + * systhread_terminate terminates the thread that is passed in. + */ +void systhread_terminate(SYS_THREAD thr); + + +/* + * systhread_sleep puts the calling thread to sleep for the given number + * of milliseconds. + */ +void systhread_sleep(int milliseconds); + +/* + * systhread_init initializes the threading system. name is a name for the + * program for debugging. + */ +void systhread_init(char *name); + +/* + * systhread_timerset starts or re-sets the interrupt timer for a thread + * system. This should be considered a suggestion as most systems don't allow + * the timer interval to be changed. + */ +#ifdef THREAD_NSPR_USER +#define systhread_timerset(usec) PR_StartEvents(usec) + +#elif defined(USE_NSPR) +#define systhread_timerset(usec) (void)(usec) + +#elif defined(THREAD_WIN32) +#define systhread_timerset(usec) (void)(usec) +#endif + + +/* + * newkey allocates a new integer id for thread-private data. Use this + * key to identify a variable which you want to appear differently + * between threads, and then use setdata to associate a value with this + * key for each thread. + */ +int systhread_newkey(void); + +/* + * Get data that has been previously associated with key in this thread. + * Returns NULL if setkey has not been called with this key by this + * thread previously, or the data that was previously used with setkey + * by this thread with this key. + */ +void *systhread_getdata(int key); + +/* + * Associate data with the given key number in this thread. + */ +void systhread_setdata(int key, void *data); + +#endif +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/util.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/util.h new file mode 100644 index 00000000000..f710ffc2530 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/util.h @@ -0,0 +1,205 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * util.h: A hodge podge of utility functions and standard functions which + * are unavailable on certain systems + * + * Rob McCool + */ + + +#ifndef HTTPD_UTIL_H +#define HTTPD_UTIL_H + +#include "buffer.h" /* filebuf for getline */ + +#include <time.h> /* struct tm */ + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * getline scans in buf until it finds a LF or CRLF, storing the string in + * l. It will terminate the string and return: + * + * 0 when done, with the scanned line (minus CR or LF) in l + * 1 upon EOF, with the scanned line (minus CR or LF) in l + * -1 on error with the error description in l (uses lineno for information) + */ + +int util_getline(filebuf *buf, int lineno, int maxlen, char *l); + + +/* + * can_exec returns 1 if you can execute the file described by finfo, and + * 0 if you can't. + */ + +#ifdef XP_UNIX +#include <sys/stat.h> +#include <sys/types.h> + +int util_can_exec(struct stat *finfo, uid_t uid, gid_t gid); + +#endif /* XP_UNIX */ +/* + * env_create creates a new environment with the given env, with n new + * entries, and places the current position that you should add your + * entries with at pos. + * + * If env is NULL, it will allocate a new one. If not, it will reallocate + * that one. + */ + +char **util_env_create(char **env, int n, int *pos); + +/* + * util_env_str allocates a string from the given name and value and + * returns it. It does not check for things like = signs in name. + */ + +char *util_env_str(char *name, char *value); + +/* + * env_replace replaces the occurrence of the given variable with the + * value you give. + */ + +void util_env_replace(char **env, char *name, char *value); + +/* + * util_env_free frees an environment. + */ + +void util_env_free(char **env); + +/* + * util_env_find looks through env for the named string. Returns the + * corresponding value if the named string is found, or NULL if not. + */ +char *util_env_find(char **env, char *name); + + +/* + * hostname gets the local hostname. Returns NULL if it can't find a FQDN. + * You are free to realloc or free this string. + */ + +char *util_hostname(void); + + +/* + * chdir2path changes the current directory to the one that the file + * path is in. path should point to a file. Caveat: path must be a writable + * string. It won't get modified permanently. + */ + +int util_chdir2path(char *path); + +/* + * is_mozilla checks if the given user-agent is mozilla, of at least + * the given major and minor revisions. These are strings to avoid + * ambiguities like 1.56 > 1.5 + */ + +int util_is_mozilla(char *ua, char *major, char *minor); + +/* + * is_url will return 1 if the given string seems to be a URL, or will + * return 0 otherwise. + * + * Because of stupid news URLs, this will return 1 if the string has + * all alphabetic characters up to the first colon and will not check for + * the double slash. + */ + +int util_is_url(char *url); + +/* + * util_later_than checks the date in the string ims, and if that date is + * later than or equal to the one in the tm struct lms, then it returns 1. + * + * Handles RFC 822, 850, and ctime formats. + */ + +int util_later_than(struct tm *lms, char *ims); + + +/* + * util_uri_is_evil returns 1 if a URL has ../ or // in it. + */ +int util_uri_is_evil(char *t); + +/* + * util_uri_parse gets rid of /../, /./, and //. + * + * Assumes that either the string starts with a /, or the string will + * not .. right off of its beginning. As such, ../foo.gif will + * not be changed, although /../foo.gif will become /foo.gif. + */ + +void util_uri_parse(char *uri); + +/* + * util_uri_unescape unescapes the given URI in place (% conversions only). + */ + +void util_uri_unescape(char *s); + +/* + * util_uri_escape escapes any nasty chars in s and copies the string into d. + * If d is NULL, it will allocate and return a properly sized string. + * Warning: does not check bounds on a given d. + * + * util_url_escape does the same thing but does it for a url, i.e. ?:+ is + * not escaped. + */ + +char *util_uri_escape(char *d, char *s); +char *util_url_escape(char *d, char *s); + +/* + * util_sh_escape places a \ in front of any shell-special characters. + * Returns a newly-allocated copy of the string. + */ + +char *util_sh_escape(char *s); + +/* + * util_itoa converts the given integer to a string into a. + */ + +int util_itoa(int i, char *a); + +/* + * util_vsprintf and util_sprintf are simplified clones of the System V + * vsprintf and sprintf routines. + * + * Returns the number of characters printed. Only handles %d and %s, + * does not handle any width or precision. + */ + +#include <stdarg.h> + +int util_vsprintf(char *s, register char *fmt, va_list args); +int util_sprintf(char *s, char *fmt, ...); + +/* These routines perform bounds checks. */ +int util_vsnprintf(char *s, int n, register char *fmt, va_list args); +int util_snprintf(char *s, int n, char *fmt, ...); + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/conf.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/conf.h new file mode 100644 index 00000000000..fd20b2eeaf3 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/conf.h @@ -0,0 +1,155 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * conf.h: Deals with the server configuration file. + * + * Object configuration is an entirely different matter. This deals with + * things like what port the server runs on, how many children it spawns, + * and other server-related issues. Information related configuration is + * handled by the object conf. + * + * Rob McCool + */ + + +#ifndef CONF_H +#define CONF_H + +#ifdef XP_WIN32 +#include <nt/ntconf.h> +#else + +#include "netsite.h" +#include "frame/objset.h" +#include "base/daemon.h" /* daemon struct */ + +#include <pwd.h> /* struct passwd */ + +/* ------------------------------ Constants ------------------------------- */ + + +/* The longest line in the configuration file */ +#define CONF_MAXLEN 16384 + +#define LF 10 +#define CR 13 + + +#if defined(DAEMON_ANY) +#ifdef MCC_PROXY +#define DEFAULT_PORT 8080 +#else +#define DEFAULT_PORT 80 +#endif +#endif + +#if defined(DAEMON_UNIX_POOL) || defined(DAEMON_UNIX_MOBRULE) +#define DEFAULT_POOL_MAX 50 +#endif + + + +/* ------------------------------- Globals -------------------------------- */ + + +#ifndef CONF_C + +/* + * These server parameters are made global because they really don't + * belong anywhere else. + */ + +#if defined(DAEMON_ANY) + +#include <sys/types.h> + +/* What port we listen to */ +extern int port; + +/* What address to bind to */ +extern char *addr; + +/* User to run as */ +extern struct passwd *userpw; + +/* Directory to chroot to */ +extern char *chr; + +/* Where to log our pid to */ +extern char *pidfn; + +#if defined(DAEMON_UNIX_POOL) || defined(DAEMON_UNIX_MOBRULE) +/* The maximum number of processes to keep in the pool */ +extern int pool_max; +/* The minimum number of processes to keep in the pool */ +extern int pool_min; +/* The maximum number of requests each process should handle. -1=default */ +extern int pool_life; +#endif + +#ifdef NET_SSL +extern char *secure_keyfn; +extern char *secure_certfn; +extern char *secure_dongle; +extern int security_active; +extern int secure_auth; +extern int security_session_timeout; +#endif + +#endif + +/* The server's hostname as should be reported in self-ref URLs */ +extern char *server_hostname; + +/* The main object from which all are derived */ +extern char *root_object; + +/* The object set the administrator has asked us to load */ +extern httpd_objset *std_os; + +/* The main error log, where all errors are logged */ +extern char *master_error_log; + +/* The e-mail address of someone to mail upon catastrophic error */ +extern char *admin_email; + +#endif + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * conf_init reads the given configuration file and sets any non-default + * parameters to their given setting. + */ + +char *conf_init(char *cfn); + +/* + * conf_terminate frees any data the conf routines may be holding. + */ + +void conf_terminate(void); + + +/* + * conf_vars2daemon transfers these globals to a daemon structure + */ +void conf_vars2daemon(daemon_s *d); + +#endif +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/dnfilter.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/dnfilter.h new file mode 100644 index 00000000000..789c19c4138 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/dnfilter.h @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +#ifndef __dnfilter_h +#define __dnfilter_h + +/* Error codes */ +#define DNFERR_MAX (-1) /* maximum error code */ +#define DNFERR_MALLOC (-1) /* insufficient memory */ +#define DNFERR_FOPEN (-2) /* file open error */ +#define DNFERR_FILEIO (-3) /* file I/O error */ +#define DNFERR_DUPSPEC (-4) /* duplicate filter specification */ +#define DNFERR_INTERR (-5) /* internal error (bug) */ +#define DNFERR_SYNTAX (-6) /* syntax error in filter file */ +#define DNFERR_MIN (-6) /* minimum error code */ + +/* This is used to return error information from dns_filter_setup() */ +typedef struct DNSFilterErr_s DNSFilterErr_t; +struct DNSFilterErr_s { + int errNo; /* DNFERR_xxxx error code */ + int lineno; /* file line number, if applicable */ + char * filename; /* filename, if applicable */ + char * errstr; /* error text, if any */ +}; + +/* Data and functions in dnfilter.c */ +extern void * dnf_objndx; +extern void dns_filter_destroy(void * dnfptr); +extern int dns_filter_setup(pblock * client, DNSFilterErr_t * reterr); +extern int dns_filter_check(pblock * client, char * cdns); + +#endif /* __dnfilter_h */ diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/func.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/func.h new file mode 100644 index 00000000000..111ffd3a375 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/func.h @@ -0,0 +1,111 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * func.h: Handles the function hash table + * + * httpd uses a table of internal functions hashed by a name string such that + * users can reference specific functions from the configuration files. + * + * Any function referenced by configuration files will be passed a + * parameter, a Request structure. The functions do not return anything. + * + * Rob McCool + */ + +#ifndef FUNC_H +#define FUNC_H + + +#include "netsite.h" +#include "base/pblock.h" +#include "base/session.h" /* Session structure */ +#include "frame/req.h" /* Request structure */ + + +/* -------------------------- Structure and Type -------------------------- */ + + +/* + * FuncPtr is a pointer to our kind of functions + */ + +typedef int Func(pblock *, Session *, Request *); +typedef Func *FuncPtr; + +/* + * FuncStruct is a structure used in the static declaration of the + * functions. This static declaration is parsed into a hash table at + * startup. You should initialize the next entry to NULL. + */ + +struct FuncStruct { + char *name; + FuncPtr func; + struct FuncStruct *next; +}; + + +/* --------------------------- Hash definitions --------------------------- */ + + +/* + * This is a primitive hash function. Once more is known about the names of + * the functions, this will be optimized. + */ + +#define NUM_HASH 20 +#define FUNC_HASH(s) (s[0] % NUM_HASH) + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * func_init reads the static FuncStruct arrays and creates the global + * function table from them. + * + * func_init will only read from the static arrays defined in func.c. + */ + +void func_init(void); + +/* + * func_find returns a pointer to the function named name, or NULL if none + * exists. + */ + +FuncPtr func_find(char *name); + +/* + * func_exec will try to execute the function whose name is the "fn" entry + * in the given pblock. If name is not found, it will log a misconfig of + * missing fn parameter. If it can't find it, it will log that. In these + * cases it will return REQ_ABORTED. Otherwise, it will return what the + * function being executed returns. + */ + +int func_exec(pblock *pb, Session *sn, Request *rq); + +/* + * func_insert dynamically inserts a named function into the server's + * table of functions. Returns the FuncStruct it keeps in internal + * databases, because on server restart you are responsible for freeing + * (or not) its contents. + */ + +struct FuncStruct *func_insert(char *name, FuncPtr fn); + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/http.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/http.h new file mode 100644 index 00000000000..b247b3805b8 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/http.h @@ -0,0 +1,170 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * http.h: Deals with HTTP-related issues + * + * Rob McCool + */ + + +#ifndef HTTP_H +#define HTTP_H + + +#include "netsite.h" +#include "base/session.h" +#include "base/pblock.h" + +#include "frame/req.h" /* REQ_MAX_LINE, Request structure */ + +/* ------------------------------ Constants ------------------------------- */ + + +#define HTTP_DATE_LEN 128 +#define HTTP_DATE_FMT "%A, %d-%b-%y %T GMT" + + +/* The maximum number of RFC-822 headers we'll allow */ +/* This would be smaller if a certain browser wasn't so damn stupid. */ +#define HTTP_MAX_HEADERS 200 + +/* Whether or not we should read the headers for if-modified-since */ +#define HTTP_DO_IMS +#define HTTP_ALWAYS_LOADHDRS + +/* HTTP status codes */ + +#define PROTOCOL_OK 200 +#define PROTOCOL_NO_RESPONSE 204 +#define PROTOCOL_REDIRECT 302 +#define PROTOCOL_NOT_MODIFIED 304 +#define PROTOCOL_BAD_REQUEST 400 +#define PROTOCOL_UNAUTHORIZED 401 +#define PROTOCOL_FORBIDDEN 403 +#define PROTOCOL_NOT_FOUND 404 +#define PROTOCOL_PROXY_UNAUTHORIZED 407 +#define PROTOCOL_SERVER_ERROR 500 +#define PROTOCOL_NOT_IMPLEMENTED 501 + + +#ifdef NET_SSL +#define HTTPS_PORT 443 +#define HTTPS_URL "https" +#endif +#define HTTP_PORT 80 +#define HTTP_URL "http" + +/* -------------------------- http_scan_headers --------------------------- */ + + +/* + * parses the first line of an HTTP request + */ + +#define protocol_parse_request http_parse_request +int http_parse_request(char *t, Request *rq, Session *sn); + +/* + * Scans HTTP headers from the given netbuf, and places them in headers. + * If netbuf is NULL, the session's inbuf is used. + * + * Folded lines are joined and the linefeed removed (but not the whitespace). + * If there are any repeat headers they are joined and the two field bodies + * separated by a comma and space. + * + * t should be a string of length REQ_MAX_LINE. This is a convenience to + * req.c so that we don't use too much runtime stack. + * + * Session is an optional parameter. Use NULL if you wish. It's used for + * error logs. + */ + +#define protocol_scan_headers http_scan_headers +int http_scan_headers(Session *sn, netbuf *buf, char *t, pblock *headers); + + +/* + * Starts the HTTP response. If HTTP/0.9, does nothing. If 1.0, sends header. + * If this returns REQ_NOACTION, the method was head and no body should be + * sent. Otherwise, it will return REQ_PROCEED. + */ + +#define protocol_start_response http_start_response +int http_start_response(Session *sn, Request *rq); + + +/* + * http_hdrs2env takes the entries from the given pblock and converts them + * to an environment. + * + * Each name entry will be made uppercase, prefixed with HTTP_ and any + * occurrence of - will be converted to _. + */ + +char **http_hdrs2env(pblock *pb); + + +/* + * http_status sets status to the code n, with reason string r. If r is + * NULL, the server will attempt to find one for the given status code. + * If it finds none, it will give "Because I felt like it." + */ + +#define protocol_status http_status +void http_status(Session *sn, Request *rq, int n, char *r); + +/* + * http_set_finfo sets content-length and last-modified + */ + +#define protocol_set_finfo http_set_finfo +int http_set_finfo(Session *sn, Request *rq, struct stat *finfo); + + +/* + * Takes the given pblock and prints headers into the given buffer at + * position pos. Returns the buffer, reallocated if needed. Modifies pos. + */ + +char *http_dump822(pblock *pb, char *t, int *pos, int tsz); + +/* + * Finishes a request. For HTTP, this just closes the socket. + */ + +#define protocol_finish_request http_finish_request +void http_finish_request(Session *sn, Request *rq); + + +/* + * http_handle_session processes each request generated by Session + */ + +#define protocol_handle_session http_handle_session +void http_handle_session(Session *sn); + +/* + * http_uri2url takes the give URI prefix and URI suffix and creates a + * newly-allocated full URL from them of the form + * http://(server):(port)(prefix)(suffix) + * + * If you want either prefix or suffix to be skipped, use "" instead of NULL. + */ + +#define protocol_uri2url http_uri2url +char *http_uri2url(char *prefix, char *suffix); + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/httpact.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/httpact.h new file mode 100644 index 00000000000..a1e1a971bb8 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/httpact.h @@ -0,0 +1,120 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * httpact.h: Defines the API characteristics for HTTP servers + * + * Rob McCool + */ + + +#ifndef HTTPACT_H +#define HTTPACT_H + +#include "frame/req.h" +#include "frame/object.h" + + +/* ------------------------------ Constants ------------------------------- */ + +#ifdef MCC_BATMAN +#define NUM_DIRECTIVES 5 +#else +#ifdef MCC_PROXY +#define NUM_DIRECTIVES 10 +#else +#define NUM_DIRECTIVES 7 +#endif +#endif + + +/* -------------------------- Generic Prototypes -------------------------- */ + + +/* + * directive_name2num will return the position of the abbreviated directive + * dir in the directive table. + * + * If dir does not exist in the table, it will return -1. + */ + +int directive_name2num(char *dir); + + +/* + * directive_num2name returns a string describing directive number num. + */ +const char *directive_num2name(int num); + + +/* + * servact_finderror looks through the request's object set to find a + * suitable error function to execute. Returns REQ_PROCEED if a function + * was found and executed successfully, REQ_NOACTION otherwise. + */ +int servact_finderror(Session *sn, Request *rq); + + +/* + * Read in and handle one request from the given session + */ +void servact_handle(Session *sn); + + +/* ----------------------- HTTP specific prototypes ----------------------- */ + + +int servact_handle_processed(Session *sn, Request *rq); + +/* + * Returns the translated path (filename) for the given uri, NULL otherwise. + * If authentication is required for the given uri, nothing is returned even + * if the current user has authenticated to that area. + */ +char *servact_translate_uri(char *uri, Session *sn); + + + +#ifdef MCC_PROXY + +/* ----------------------- proxy specific prototypes ---------------------- */ + +/* + * Resolves the given hostname, first trying to find a resolver + * function from obj.conf, and if that fails, just calls gethostbyname(). + * + */ +struct hostent *servact_gethostbyname(char *host, Session *sn, Request *rq); + + +/* + * Establishes a connection to the specified host and port using + * a Connect class function from obj.conf. Returns the sockect + * descriptor that is connected (and which should be SSL_Import()'ed + * by the caller). + * + * Returns -2 (REQ_NOACTION), if no such Connect class function exists. + * The caller should use the native connect mechanism in that case. + * + * Returns -1 (REQ_ABORT) on failure to connect. The caller should not + * attempt to use the native connect. + * + */ +int servact_connect(char *host, int port, Session *sn, Request *rq); + + +#endif /* ! MCC_PROXY */ + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/ipfilter.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/ipfilter.h new file mode 100644 index 00000000000..2aa32502d8f --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/ipfilter.h @@ -0,0 +1,48 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +#ifndef __ipfilter_h +#define __ipfilter_h + +/* Define error codes */ +#define IPFERR_MAX (-1) /* maximum error code value */ +#define IPFERR_MALLOC (-1) /* insufficient memory */ +#define IPFERR_FOPEN (-2) /* file open error */ +#define IPFERR_FILEIO (-3) /* file I/O error */ +#define IPFERR_DUPSPEC (-4) /* duplicate filter specification */ +#define IPFERR_INTERR (-5) /* internal error (bug) */ +#define IPFERR_SYNTAX (-6) /* syntax error in filter file */ +#define IPFERR_CNFLICT (-7) /* conflicting filter specification */ +#define IPFERR_MIN (-7) /* minimum error code value */ + +/* Define a scalar IP address value */ +typedef unsigned long IPAddr_t; + +/* Define structure for returning error information */ +typedef struct IPFilterErr_s IPFilterErr_t; +struct IPFilterErr_s { + int errNo; /* IPFERR_xxxx error code */ + int lineno; /* file line number, if applicable */ + char * filename; /* filename, if applicable */ + char * errstr; /* error text, if any */ +}; + +/* Data and functions in ipfilter.c */ +extern void * ipf_objndx; +extern void ip_filter_destroy(void * ipfptr); +extern int ip_filter_setup(pblock * client, IPFilterErr_t * reterr); +extern int ip_filter_check(pblock * client, IPAddr_t cip); + +#endif /* __ipfilter_h */ diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/log.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/log.h new file mode 100644 index 00000000000..1113ebe6867 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/log.h @@ -0,0 +1,51 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * log.h: Records transactions, reports errors to administrators, etc. + * + * Rob McCool + */ + + +#ifndef LOG_H +#define LOG_H + + +#include "netsite.h" +#include "base/session.h" /* Session structure */ +#include "frame/req.h" /* Request struct */ +#include "base/ereport.h" /* Error reporting, degrees */ + + +#define ERROR_CUTOFF 128 + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * log_error logs an error of the given degree from the function func + * and formats the arguments with the printf() style fmt. Returns whether the + * log was successful. Records the current date. + * + * sn and rq are optional parameters. If given, information about the client + * will be reported. + */ + +int log_error(int degree, char *func, Session *sn, Request *rq, + char *fmt, ...); + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/object.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/object.h new file mode 100644 index 00000000000..45180c5b884 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/object.h @@ -0,0 +1,167 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * object.h: Handle httpd objects + * + * Manages information about a document from config. files. Called mainly + * by objset.c. + * + * This module does not assume anything about the directives being parsed. + * That is handled by objset.c. + * + * This module requires the pblock module from the base library. + * + * Rob McCool + * + */ + + +#ifndef OBJECT_H +#define OBJECT_H + + +#include "netsite.h" +#include "base/pblock.h" +#include "base/session.h" + + + + +/* ------------------------------ Constants ------------------------------- */ + + +/* The maximum directive length unabbreviated, plus one space */ +#define MAX_DNAME_LEN 11 +#define NUM_DIRECTIVES 7 + + +/* ------------------------------ Structures ------------------------------ */ + + + +/* + * Hierarchy of httpd_object + * + * An object contains dtables. + * + * Each dtable is a table of directives that were entered of a certain type. + * There is one dtable for each unique type of directive. + * + * Each dtable contains an array of directives, each of which is equivalent + * to one directive that occurred in a config. file. + * + * It is up to the caller to determine how many dtables will be allocated + * and to keep track of which of their directive types maps to which dtable + * number. + */ + + +/* + * directive is a structure containing the protection and parameters to an + * instance of a directive within an httpd_object. + * + * param is the parameters, client is the protection. + */ + +typedef struct { + pblock *param; + pblock *client; +} directive; + +/* + * dtable is a structure for creating tables of directives + */ + +typedef struct { + int ni; + directive *inst; +} dtable; + +/* + * The httpd_object structure. + * + * The name pblock array contains the names for this object, such as its + * virtual location, its physical location, or its identifier. + * + * tmpl contains any templates allocated to this object. + */ + +typedef struct { + pblock *name; + + int nd; + dtable *dt; +} httpd_object; + + + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * directive_name2num will return the position of the abbreviated directive + * dir in the directive table. + * + * If dir does not exist in the table, it will return -1. + */ + +int directive_name2num(char *dir); + + +/* + * directive_num2name returns a string describing directive number num. + */ + +const char *directive_num2name(int num); + + +/* + * object_create will create a new object and return a pointer to it. + * It will allocate space for nd directive types and set name accordingly. + */ + +httpd_object *object_create(int nd, pblock *name); + +/* + * object_free will free an object and any data associated with it. + */ + +void object_free(httpd_object *obj); + +/* + * object_add_directive will add a new directive to the dtable for + * the directive class at position dc. + */ + +void object_add_directive(int dc, pblock *p, pblock *c, httpd_object *obj); + + +/* + * object_findnext finds the object configured to follow the given object, + * and stores the variables in rq->vars. It returns REQ_PROCEED if more + * objects should be processed, or REQ_NOACTION if it did not find any + * further objects to process. If something bad happens, REQ_ABORTED is + * returned. + * + * Handles all DIRECTIVE_CONSTRUCT type directives such as NameTrans and + * AuthType. + */ + + +/* --------- Prototype moved to req.h because of interdependency ---------- */ + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/objset.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/objset.h new file mode 100644 index 00000000000..fe68c31eb04 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/objset.h @@ -0,0 +1,158 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * objset.h: Handles object sets + * + * Each object is produced by reading a config file of some form. See the + * server documentation for descriptions of the directives that are + * recognized, what they do, and how they are parsed. + * + * This module requires the pblock and buffer modules from the base library. + * + * Rob McCool + */ + + +#ifndef OBJSET_H +#define OBJSET_H + +#ifdef XP_WIN32 +#include <nt/ntobjset.h> +#else + + +#include "netsite.h" +#include "base/pblock.h" +#include "base/buffer.h" +#include "frame/object.h" + + + +/* ------------------------------ Constants ------------------------------- */ + + +/* + * The default number of objects to leave room for in an object set, + * and the number of new entries by which to increase the size when that + * room is filled. + */ + +#define OBJSET_INCSIZE 8 + +/* + * When parsing config. files, httpd will put a limit on how long + * the parameters to a directive can be (in characters). + * + * Currently set to 10 lines (80 chars/line). + */ + +#define MAX_DIRECTIVE_LEN 800 + +/* + * The size of the hash tables that store a directive's parameters + */ + +#define PARAMETER_HASH_SIZE 3 + + +/* ------------------------------ Structures ------------------------------ */ + + +/* + * httpd_objset is a container for a bunch of objects. obj is a + * NULL-terminated array of objects. pos points to the entry after the last + * one in the array. You should not mess with pos, but can read it to find + * the last entry. + */ + +typedef struct { + int pos; + httpd_object **obj; +} httpd_objset; + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * objset_scan_buffer will scan through buffer, looking for object + * configuration information, and adding them to the object set os if it + * finds any. If os is NULL it will allocate a new object set. + * + * If any error occurs (syntax error, premature EOF) this function will + * free os, print an error message into errstr, and return NULL. + * This is because a config. file error is viewed as a catastrophic error + * from which httpd should not try to recover. If httpd were to continue + * after an error, it would not behave as the admin. expected and he/she + * may not notice until it's too late. + * + * Upon EOF the file will not be closed. + */ + +httpd_objset *objset_scan_buffer(filebuf *buf, char *errstr, httpd_objset *os); + +/* + * objset_create creates a new object set and returns a pointer to it. + */ + +httpd_objset *objset_create(void); + +/* + * objset_free will free an object set and any associated objects. + */ + +void objset_free(httpd_objset *os); + +/* + * objset_free_setonly frees only the object set. + */ +void objset_free_setonly(httpd_objset *os); + +/* + * objset_new_object will add a new object to objset with the specified + * name. It returns a pointer to the new object (which may be anywhere in + * the objset). + */ + +httpd_object *objset_new_object(pblock *name, httpd_objset *os); + +/* + * objset_add_object will add the existing object to os. + */ + +void objset_add_object(httpd_object *obj, httpd_objset *os); + +/* + * objset_findbyname will find the object in objset having the given name, + * and return the object if found, and NULL otherwise. + * ign is a set of objects to ignore. + */ + +httpd_object *objset_findbyname(char *name, httpd_objset *ign, + httpd_objset *os); + +/* + * objset_findbyppath will find the object in objset having the given + * partial path entry. Returns object if found, NULL otherwise. + * ign is a set of objects to ignore. + */ + +httpd_object *objset_findbyppath(char *ppath, httpd_objset *ign, + httpd_objset *os); + + +#endif +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/protocol.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/protocol.h new file mode 100644 index 00000000000..d44705a60cc --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/protocol.h @@ -0,0 +1,27 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * protocol.h: Switch which protocol we're speaking. + * + * Currently only HTTP, but expected to include MTP in the future. + * + * Rob McCool + */ + + +#ifdef MCC_HTTPD +#include "http.h" +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/req.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/req.h new file mode 100644 index 00000000000..afe525150c6 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/req.h @@ -0,0 +1,216 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * req.h: Request-specific data structures and functions + * + * Rob McCool + */ + + +#ifndef REQ_H +#define REQ_H + + +#include "netsite.h" +#include "base/pblock.h" +#include "base/session.h" +#include "frame/objset.h" + +#include <sys/stat.h> + + + +/* ------------------------------ Constants ------------------------------- */ + + +#define REQ_HASHSIZE 10 +#define REQ_MAX_LINE 4096 + + +/* + * The REQ_ return codes. These codes are used to determine what the server + * should do after a particular module completes its task. + * + * Func type functions return these as do many internal functions. + */ + +/* The function performed its task, proceed with the request */ +#define REQ_PROCEED 0 +/* The entire request should be aborted: An error occurred */ +#define REQ_ABORTED -1 +/* The function performed no task, but proceed anyway. */ +#define REQ_NOACTION -2 +/* Tear down the session and exit */ +#define REQ_EXIT -3 + + + +/* ------------------------------ Structures ------------------------------ */ + + +typedef struct { + /* Server working variables */ + pblock *vars; + + /* The method, URI, and protocol revision of this request */ + pblock *reqpb; + /* Protocol specific headers */ + int loadhdrs; + pblock *headers; + + /* Server's response headers */ + pblock *srvhdrs; + + /* The object set constructed to fulfill this request */ + httpd_objset *os; + /* Array of objects that were created from .nsconfig files */ + httpd_objset *tmpos; + + /* The stat last returned by request_stat_path */ + char *statpath; + char *staterr; + struct stat *finfo; + +#ifdef MCC_PROXY + /* SOCKS request data */ + void *socks_rq; +#endif + +} Request; + + +/* ------------------------------ Prototypes ------------------------------ */ + + +/* + * request_create creates a new request structure. + */ + +Request *request_create(void); + +/* + * request_free destroys a request structure. + */ + +void request_free(Request *req); + + +/* + * Restarts a request for a given URI internally. If rq is non-NULL, the + * function will keep the old request's headers and protocol, but with a new + * URI and method of GET. If the previous method was HEAD, this is preserved. + * Any other method becomes GET. You may assume that if you give it a request + * structure that it will use the same structure. + * + * Once you have this new Request, you must then do what you want with + * it (e.g. send the object back, perform uri2path translation, etc.) + */ + +Request *request_restart_internal(char *uri, Request *rq); + + +/* + * request_translate_uri performs virtual to physical mapping on the given + * uri and returns either a path string or NULL depending on whether it was + * successful or not. + */ + +char *request_translate_uri(char *uri, Session *sn); + + +/* + * request_header finds the named header depending on the requesting + * protocol. If possible, it will not load headers until the first is + * requested. You have to watch out because this can return REQ_ABORTED. + */ + +int request_header(char *name, char **value, Session *sn, Request *rq); + +/* + * request_loadheaders just makes sure the headers have been loaded. + */ + +int request_loadheaders(Session *sn, Request *rq); + + +/* + * request_stat_path tries to stat path. If path is NULL, it will look in + * the vars pblock for "path". If the stat is successful, it returns the stat + * structure. If not, returns NULL and leaves a message in rq->staterr. If a + * previous call to this function was successful, and path is the same, the + * function will simply return the previously found value. + * + * User functions should not free this structure. + */ + +struct stat *request_stat_path(char *path, Request *rq); + + +/* + * Parses the URI parameter in rq->vars and finds out what objects it + * references (using NameTrans). Builds the request's object set. + */ + +int request_uri2path(Session *sn, Request *rq); + +/* + * Performs any path checks needed for this request. + */ + +int request_pathchecks(Session *sn, Request *rq); + +/* + * Does all the ObjectType directives for a request + */ + +int request_fileinfo(Session *sn, Request *rq); + + +/* + * request_handle_processed takes a Request structure with its reqpb + * block filled in and handles the request. + */ + +int request_handle_processed(Session *sn, Request *rq); + + +/* + * Complete a request by finding the service function and using it. Returns + * REQ_NOACTION if no matching function was found. + */ + +int request_service(Session *sn, Request *rq); + + +/* + * request_handle handles one request from the session's inbuf. + */ + +void request_handle(Session *sn); + +/* + * Moved here due to problems with interdependency. See object.h for + * description. + */ + +int object_findnext(Session *sn, Request *rq, httpd_object *obj); +int object_pathcheck(Session *sn, Request *rq, httpd_object *obj); +int object_findinfo(Session *sn, Request *rq, httpd_object *obj); +int object_findservice(Session *sn, Request *rq, httpd_object *obj); +int object_finderror(Session *sn, Request *rq, httpd_object *obj); +int object_findlogs(Session *sn, Request *rq, httpd_object *obj); + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/servact.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/servact.h new file mode 100644 index 00000000000..9e6df32c6d4 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/frame/servact.h @@ -0,0 +1,26 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * servact.h: Define the server's actions, depending on what type of + * server it is. + * + * Rob McCool + */ + + +#if defined(MCC_HTTPD) || defined(MCC_PROXY) || defined(MCC_NEWS) +#include "httpact.h" +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/netsite.h b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/netsite.h new file mode 100644 index 00000000000..80f114d3fb5 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-includes/netsite.h @@ -0,0 +1,67 @@ +/* + * $Id$ + * + * Copyright (c) 1994, 1995. Netscape Communications Corporation. All + * rights reserved. + * + * Use of this software is governed by the terms of the license agreement for + * the Netscape Communications or Netscape Comemrce Server between the + * parties. + */ + + +/* ------------------------------------------------------------------------ */ + + +/* + * Standard defs for NetSite servers. + */ + + +#ifndef NETSITE_H +#define NETSITE_H + +#ifdef MCC_PROXY +#define MAGNUS_VERSION "1.1m" +#define MAGNUS_VERSION_STRING "Netscape-Proxy/1.1m" + +#elif defined(MCC_ADMSERV) +#define MAGNUS_VERSION "1.1" +#define MAGNUS_VERSION_STRING "Netscape-Administrator/1.1" + +#elif defined(MCC_HTTPD) +#define MAGNUS_VERSION "1.1" +#ifdef NET_SSL +#define MAGNUS_VERSION_STRING "Netscape-Commerce/1.12" +#else +#define MAGNUS_VERSION_STRING "Netscape-Communications/1.12" +#endif + +#elif defined(MCC_NEWS) +#define MAGNUS_VERSION_STRING "Netscape 1.1" +#endif + +/* Used in some places as a length limit on error messages */ +#define MAGNUS_ERROR_LEN 8192 + +/* Carraige return and line feed */ +#define CR 13 +#define LF 10 + +/* -------------------------- Memory allocation --------------------------- */ + + +/* Later change these to have catastrophic error handling */ + +#include <stdlib.h> + +#define MALLOC(sz) malloc(sz) +#define FREE(ptr) free((void *)ptr) +#define STRDUP(str) strdup(str) +#define REALLOC(ptr,sz) realloc(ptr,sz) + + +/* Not sure where to put this. */ +void magnus_atrestart(void (*fn)(void *), void *data); + +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-send.c b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-send.c new file mode 100644 index 00000000000..70e99d33a87 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-send.c @@ -0,0 +1,88 @@ +/* $Id$ */ +/* + * Send random bits file + * Once this service function is installed, any file with the extension + * "dyn-send" will be serviced with this function. An optional query + * string may be passed to alter the amount of data in the response. + * + * For example: + * /file.dyn-send - returns a 10240 byte file + * /file.dyn-send?size=20 - returns a 20 byte file + * /file.dyn-send?size=1024 - returns a 1024 byte file + * etc. + * + * To install the service routine, compile it as per the makefile + * included with your Netscape server distribution (serverroot/nsapi/examples) + * and then add the following lines to your netscape server configuration: + * + * in magnus.conf + * Init fn=load-modules shlib=example.so funcs=nsapi-send + * + * in obj.conf + * Service method=(GET|HEAD) fn=nsapi-send type=magnus-internal/dyn-send + * + * in mime.types + * type=magnus-internal/dyn-send exts=dyn-send + * + * Mike Belshe + * mbelshe@netscape.com + * 11-5-95 + * + */ + +#ifndef WIN32 +#include <stdio.h> +#include <stdlib.h> +#include "base/pblock.h" +#include "base/session.h" +#include "frame/protocol.h" +#include "base/util.h" +#include "frame/http.h" +#else +#include <windows.h> +#define FILE_STDIO 1 +#endif +#include "frame/req.h" + +#define FILE_SIZE 10240 +#define HEADERS "HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n" + +#ifdef WIN32 +__declspec(dllexport) +#endif + +int nsapi_send(pblock *pb, Session *sn, Request *rq) +{ + char *query_string; + char buffer[sizeof(HEADERS) + 204800 + 1]; + int filesize; + unsigned int maxindex; + unsigned int index; + + /* Get the query string, if any; check to see if an alternate + * file size was specified. + */ + if ( !(query_string = pblock_findval("query", rq->reqpb)) ) + filesize = FILE_SIZE; + else { + filesize = atoi(&(query_string[5])); + } + + memcpy(&buffer, HEADERS, sizeof(HEADERS)-1); + + /* Generate the output */ + maxindex = sizeof(HEADERS) + filesize; + for (index=sizeof(HEADERS); index < (maxindex); index++) + /* generate random characters from A-Z */ +#ifdef IRIX + buffer[index] = rand_r() % 26 + 63; +#else + buffer[index] = rand() %26 + 63; +#endif + + /* Send the output */ + if (net_write(sn->csd, buffer, sizeof(HEADERS)-1+filesize, 0) == IO_ERROR) + return REQ_EXIT; + + return REQ_PROCEED; +} diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/parse_file_list.c b/ACE/apps/JAWS/clients/WebSTONE/src/parse_file_list.c new file mode 100644 index 00000000000..e201c51d4db --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/parse_file_list.c @@ -0,0 +1,290 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ +#include <stdio.h> +#include <errno.h> +#include <signal.h> +#include <stdlib.h> +#include <string.h> + +#ifndef WIN32 +#include <netdb.h> +#include <sys/param.h> +#endif /* WIN32 */ + +#include <sys/types.h> + +#ifndef WIN32 +#include <sys/ipc.h> +#include <sys/shm.h> +#include <sys/errno.h> +#include <sys/socket.h> +#include <sys/time.h> +#include <netinet/in.h> +#else +#include <windows.h> +#include <process.h> +#include <time.h> +#include <winsock.h> +#endif /* WIN32 */ + +#include <ctype.h> + +#include "sysdep.h" +#include "bench.h" + + +/* + * count_file_list() + * given a filename, return a guess at the number of pages + */ +int +count_file_list(const char *url_list_file) +{ + FILE *fp; + long int num_of_pages; + char a_line[BUFSIZ]; + char *textvalue; + int returnval; + + fp = fopen(url_list_file, "r"); + + if (fp == NULL) + { + D_PRINTF( "Error %d opening filelist %s: %s\n", + errno, url_list_file, strerror(errno) );; + return(returnerr("Error %d opening filelist %s: %s\n", + errno, url_list_file, strerror(errno))); + } + else + { + num_of_pages = 0; + D_PRINTF( "Opened file, about to count\n" ); + /* + * parse through the file line-by-line + * strip out comments, but don't check for URL consistency + */ + while (fgets(a_line, BUFSIZ, fp) != NULL) + { + textvalue = a_line; + /* check for comments */ + if (strchr(textvalue, '#') != NULL) + { + /* throw out anything after any '#' */ + D_PRINTF( "Stripping comment from line: %s\n", textvalue ); + returnval = strcspn(textvalue, "#"); + D_PRINTF( "Found first # at %d\n", returnval ); + if (returnval == 0) + { + textvalue = NULL; + } + } + /* is there more? */ + if (textvalue != NULL) + { + num_of_pages++; + D_PRINTF( "Found %ld pages\n", num_of_pages ); + } + } + return(num_of_pages); + } + fclose(fp); +} /* end count_file_list() */ + +/* + * parse_file_list() + * given a filename, a pointer to a page list, and pointers to integers + * for the number of pages and the number of files, parse its contents. + */ +void +parse_file_list (const char *url_list_file, page_list_t *page_list, + long int *num_of_pages, long int *num_of_files) +{ + FILE *fp; + int filenum; + int returnval; + int loadnum; + char a_line[BUFSIZ]; + char tempbuf[BUFSIZ]; + char *textvalue; + int numfiles = 1, numpages = 0; + int maxpages = *num_of_pages; + page_list_t *pp; + + extern int haveproxyserver; + + fp = fopen(url_list_file, "r"); + + if (fp == NULL) + { + errexit("Error %d opening filelist: %s\n", errno, strerror(errno)); + } + else + { + /* + * GRAB A LINE. FORMAT IS: URL WEIGHTINGFACTOR + * EXAMPLE: http://www/file.html 1 + */ + D_PRINTF( "File is open.\n" ); + while(fgets(a_line, BUFSIZ, fp) != NULL) + { + textvalue = a_line; + /* check for comments */ + if (strchr(textvalue, '#') != NULL) + { + /* throw out anything after a '#' */ + D_PRINTF( "Stripping comment from line: %s\n", textvalue ); + returnval = strcspn(textvalue, "#"); + D_PRINTF( "Found first # at %d\n", returnval ); + if (returnval == 0) + continue; + } + + if (numpages >= *num_of_pages) + errexit("Out of space in parse_file_list()\n"); + + pp = &page_list[numpages]; + + D_PRINTF( "Processing page %ld\n", numpages ); + loadnum = 0; + + if (textvalue != NULL) { /* is there more? */ + /* check for weighting factor */ + D_PRINTF( "Setting page values from: %s\n", textvalue ); + returnval = sscanf(textvalue, "%s%d", tempbuf, &loadnum); + D_PRINTF( "Scan for weighting returns %d, %d\n", + returnval, loadnum ); + if (returnval == EOF || loadnum <= 0) + { + pp->load_num = 1; + } + else + { + pp->load_num = loadnum; + } + D_PRINTF( "Setting load=%d for line: %s\n", + pp->load_num, textvalue ); + + /* placeholder for grouping multiple files onto one page */ + pp->num_of_files = 1; + filenum = 0; + + textvalue = tempbuf; + D_PRINTF( "Line is now: %s\n", textvalue ); + + /* + * if we've got a proxy server, we'll assume that the + * remaining text is a valid URL, and stuff it into + * page_list[numpages].filename[filenum] + * Otherwise, we'll have to parse it out. + */ + + if (haveproxyserver) + { + pp->servername[filenum] = NULL; + pp->port_number[filenum] = 0; + strcpy(pp->filename[filenum], textvalue); + } + else /* no proxy server, so we have to parse it out... */ + { + /* try http://server(:port)/file */ + D_PRINTF( "Trying http://server(:port)/filename\n" ); + returnval = sscanf(textvalue, "http://%[^/]%s", + tempbuf, + a_line); + /* check server string for :port */ + if (returnval != 0 && returnval != EOF) + { + D_PRINTF( "Setting filename %s\n", a_line ); + strcpy(pp->filename[filenum], + a_line); + + D_PRINTF( "Checking %s for :portnumber\n", tempbuf ); + returnval = sscanf(tempbuf, "%[^:]:%d", + a_line, + &pp->port_number[filenum]); + + if (returnval < 2) + { + pp->port_number[filenum] = 80; + } + if (returnval == EOF) + { + pp->servername[filenum] = NULL; + } + else + { + D_PRINTF( "Port number %d, setting server %s\n", + pp->port_number[filenum], + a_line ); + + strcpy(pp->servername[filenum], a_line); + } + + D_PRINTF( "Server %s, port number %d\n", + pp->servername[filenum], + pp->port_number[filenum] ); + } + else /* no good - try straight filename */ + { + pp->port_number[filenum] = 80; + D_PRINTF( "Trying filename, returnval=%d\n", + returnval ); + pp->servername[filenum] = NULL; + D_PRINTF( "Server %s, port number %d\n", + pp->servername[filenum], + pp->port_number[filenum] ); + returnval = sscanf(textvalue, "%s", a_line); + D_PRINTF( "Scan returned filename %s\n", a_line ); + + strcpy(pp->filename[filenum], a_line); + } /* end of parsing */ + } /* end if haveproxyserver */ + + D_PRINTF( "Done parsing line\n" ); + D_PRINTF( "Got server %s, port %d, file %s, returnval %d\n", + pp->servername[filenum], + pp->port_number[filenum], + pp->filename[filenum], + returnval ); + } /* end if textvalue not NULL */ + + numpages++; + } /* end while not EOF */ + if (numpages < 1) + { + returnerr("No files are specified by filelist\n"); + } + } /* end if file ok */ + fclose(fp); + D_PRINTF( "Returning %ld pages and %ld files\n", + numpages, numfiles ); + + *num_of_pages = numpages; + *num_of_files = numfiles; +} +/* end parse_file_list */ + +long int +load_percent(page_list_t *page_list, long int number_of_pages) +{ + int i; + long int index_number = 0; + + for (i = 0; i < number_of_pages; i++) + { + index_number += page_list[i].load_num; + } + + D_PRINTF( "load_percent returning %d\n", (index_number) ); + return(index_number); +} + diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/parse_file_list.h b/ACE/apps/JAWS/clients/WebSTONE/src/parse_file_list.h new file mode 100644 index 00000000000..715686228db --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/parse_file_list.h @@ -0,0 +1,20 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs where * + * deveolped by SGI for public use. If anychanges are made to this code * + * please try to get the changes back to the author. Feel free to make * + * modfications and changes to the code and release it. * + * * + **************************************************************************/ +#ifndef __PARSE_FILE_LIST_H__ +#define __PARSE_FILE_LIST_H__ + +extern int count_file_list(const char *); + +extern void parse_file_list (char *, page_list_t *, + long int *, long int *); + +#endif /* !__PARSE_FILE_LIST_H__ */ diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/rexec.c b/ACE/apps/JAWS/clients/WebSTONE/src/rexec.c new file mode 100644 index 00000000000..0a6792e6320 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/rexec.c @@ -0,0 +1,373 @@ +/* $Id$ */ +/* + * Copyright (c) 1994-1995 Ataman Software, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Ataman Software, Inc. + * 4. The name of Ataman Software, Inc. may not may be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY ATAMAN SOFTWARE, INC. ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL ATAMAN SOFTWARE, INC. BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +static char copyright[] = + "Copyright (c) 1994-1995 Ataman Software, Inc. All rights reserved."; + + +#pragma warning(disable: 4699) +/* Includes for Win32 systems go here. */ +#define STRICT +#pragma warning(disable: 4201) +#include <windows.h> +#pragma warning(default: 4201) +#include <winsock.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <process.h> +#include <signal.h> +#include "sysdep.h" +#include "bench.h" + +#define RETVAL DWORD +#define IDENT HANDLE +#define STDINPUT hStdIn +#define STDOUTPUT hStdOut +#define STDERROR hStdErr +#define FILECOOKIE HANDLE + +static void PassOutputThread(SOCKET); +static void PassErrorThread(SOCKET); + +HANDLE hStdIn, hStdOut, hStdErr; + + + +/* +Think carefully before enabling the -p option. While it may be +convenient to have this option, it is for many (if not most) sites a +security hole. Remember that the '-p password' used on the command +line is visible on most Unix systems to any user that is allow to run +the 'ps' command (normally ALL users can run this command). While no +utility that comes by default with Windows NT at this time shows the +same information, it is unclear whether or not the information is +avaiable to all users. Certainly privileged users would be be able to +see this information on any system. + +If the security risk is acceptable at your site, you can enable the -p +option by uncommenting the #define below. +*/ +/* #define ALLOWDASH_P */ + +static void MyOpenService(const char *remote_host); +static BOOL Send(SOCKET, const char *, size_t); +static BOOL SendZString(const char *); +static BOOL GetErrString(char *, size_t); + +static IDENT PassInput(void); +static IDENT PassOutput(void); +static IDENT PassError(void); +static BOOL Close(FILECOOKIE); +static int Read(FILECOOKIE, char *, size_t); +static BOOL Write(FILECOOKIE, const char *, size_t); +static void Wait(IDENT, RETVAL *); + +static SOCKET sIO = INVALID_SOCKET; +static SOCKET sErr = INVALID_SOCKET; + +IDENT idIn = 0; +IDENT idOut, idErr; + +SOCKET rexec(const char **hostname, NETPORT port, char *username, char *password, + char *command, SOCKET *sockerr) +{ + + MyOpenService(*hostname); + + SendZString(username); + SendZString(password); + SendZString(command); + + if (!GetErrString(command, sizeof command)) { + errexit("Rexec: Remote aborted connection without initiating protocol: %s.\n", + neterrstr()); + } + + if (*command != '\0') { + char *p = command; + if (*p == '\001') { + p++; + } + errexit("Rexec: Remote aborted connection: %s\n", p); + } + + hStdIn = GetStdHandle(STD_INPUT_HANDLE); + hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); + hStdErr = GetStdHandle(STD_ERROR_HANDLE); + + *sockerr = sErr; + return sIO; +} + + +static void MyOpenService(const char *remote_host) +{ + struct sockaddr_in server_addr, my_err_addr, junk_addr; + struct servent *sv; + static char portbuf[30]; + SOCKET sTmp; + int addr_len; + + if (remote_host[0] >= '0' && remote_host[0] <= '9') { + unsigned long addr; + + addr = inet_addr(remote_host); + if (addr == INADDR_NONE) { + returnerr("Invalid IP address %s\n", remote_host); + return; + } + server_addr.sin_addr.S_un.S_addr = addr; + } else { + struct hostent *hent; + + hent = gethostbyname(remote_host); + if (hent == NULL) + { + D_PRINTF( "Can't get %s host entry\n", remote_host ); + D_PRINTF( "Gethostbyname failed: %d", WSAGetLastError() ); + errexit("Rexec: gethostbyname(%s) failed: %s\n", + remote_host, neterrstr()); + } + memcpy((char *)&server_addr.sin_addr, hent->h_addr, hent->h_length); +} + +#ifdef OMIT + hent = gethostbyname(remote_host); + if(!hent) { + errexit("Rexec: Lookup of server hostname failed: %s.\n", + neterrstr()); + } +#endif /* OMIT */ + + sv=getservbyname("exec", "tcp"); + if (!sv) { + errexit("Rexec: Lookup of port number for rexec service failed: %s.\n", + neterrstr()); + } + + server_addr.sin_family = PF_INET; + server_addr.sin_port = htons(sv->s_port); + + if((sIO=socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) { + errexit("Rexec: I/O socket creation failed: %s.\n", + neterrstr()); + } + + if(connect(sIO, (struct sockaddr *)&server_addr, sizeof server_addr) == SOCKET_ERROR) { + errexit("Rexec: I/O socket connection failed: %s.\n", + neterrstr()); + } + + memset(&my_err_addr, '\0', sizeof my_err_addr); + my_err_addr.sin_addr.s_addr = htonl(INADDR_ANY); + my_err_addr.sin_family = AF_INET; + my_err_addr.sin_port = 0; + + if ((sTmp=socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) { + errexit("Rexec: Error socket creation failed: error=%s.\n", + neterrstr()); + } + + if (bind(sTmp, (struct sockaddr *)&my_err_addr, sizeof my_err_addr) == SOCKET_ERROR) { + errexit("Rexec: Error socket bind failed: %s.\n", + neterrstr()); + (void) closesocket(sTmp); + } + + if (listen(sTmp, 1) == SOCKET_ERROR) { + errexit("Rexec: Error socket listen failed: %s.\n", + neterrstr()); + (void) closesocket(sTmp); + } + + addr_len = sizeof my_err_addr; + if (getsockname(sTmp, (struct sockaddr *)&my_err_addr, &addr_len) == SOCKET_ERROR) { + errexit("Rexec: Error socket bind failed: %s.\n", + neterrstr()); + (void) closesocket(sTmp); + } + + sprintf(portbuf, "%hu", ntohs(my_err_addr.sin_port)); + SendZString(portbuf); + + addr_len = sizeof junk_addr; + if ((sErr = accept(sTmp, (struct sockaddr *)&junk_addr, &addr_len)) + == INVALID_SOCKET) { + errexit("Rexec: Error socket accept failed: %s.\n", + neterrstr()); + (void) closesocket(sTmp); + } + + (void) closesocket(sTmp); +} + + + +static BOOL Send(SOCKET s, const char *buf, size_t nbuf) +{ + int cnt; + size_t sent = 0; + + while (sent < nbuf) { + cnt = send(s, &buf[sent], nbuf-sent, 0); + if (cnt == -1) { + return FALSE; + } + sent += cnt; + } + return TRUE; +} + + +static BOOL SendZString(const char *str) +{ + return Send(sIO, str, strlen(str)+1); +} + + +static BOOL GetErrString(char *str, size_t len) +{ + size_t pos = 0; + + while (pos < len) { + char ch; + if (recv(sIO, &ch, 1, 0) != 1) { + return FALSE; + } + str[pos++] = ch; + if (ch == '\0') { + return TRUE; + } + if (ch == '\n') { + return TRUE; + } + } + return FALSE; +} + + +static IDENT PassOutput() +{ + IDENT id; + id = (IDENT)_beginthread(PassOutputThread, 4096, (void *)sIO); + if ((long)id == -1) { + errexit("Rexec: Could not start output passing thread: error = %lu\n", GetLastError()); + } + return id; +} + +static void PassOutputThread(SOCKET sIO) +{ + RETVAL retval = 0; + int count; + char buf[4096]; + + while ((count=recv(sIO, buf, sizeof buf, 0)) > 0) { + if (!Write(STDOUTPUT, buf, count)) { + fprintf(stderr, "Error writing to standard output: error = %lu.\n", GetLastError()); + retval = 1; + break; + } + } + + _endthread(); +} + + +static IDENT PassError() +{ + IDENT id; + id = (IDENT)_beginthread(PassErrorThread, 4096, (void *)sErr); + if ((long)id == -1) { + errexit("Rexec: Could not start error passing thread: error = %lu\n", GetLastError()); + } + return id; +} + +static void PassErrorThread(SOCKET sErr) +{ + RETVAL retval = 0; + int count; + char buf[4096]; + + while ((count=recv(sErr, buf, sizeof buf, 0)) > 0) { + if (!Write(STDERROR, buf, count)) { + fprintf(stderr, "Error writing to standard error: error = %lu.\n", GetLastError()); + retval = 1; + break; + } + } + _endthread(); +} + +static BOOL Close(FILECOOKIE fc) +{ + return CloseHandle(fc); +} + +static int Read(FILECOOKIE fc, char *buf, size_t nbuf) +{ + DWORD cbRead; + if (!ReadFile(fc, buf, nbuf, &cbRead, NULL)) { + return -1; + } + return (int)cbRead; +} + + +static BOOL Write(FILECOOKIE fc, const char *buf, size_t nbuf) +{ + DWORD cbWritten; + + if (!WriteFile(fc, buf, nbuf, &cbWritten, NULL)) { + return FALSE; + } + if (cbWritten != nbuf) { + return FALSE; + } + return TRUE; +} + + +static void +Wait(IDENT id, RETVAL *prv) +{ + if (!WaitForSingleObject(id, INFINITE)) { + *prv = 2; + } else { + if (!GetExitCodeThread(id, prv)) { + *prv = 4; + } + } +} diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/statistics.c b/ACE/apps/JAWS/clients/WebSTONE/src/statistics.c new file mode 100644 index 00000000000..efc82c96e9a --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/statistics.c @@ -0,0 +1,49 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +/* FUZZ: disable check_for_math_include */ +#include <math.h> +#include <stdlib.h> +#include "sysdep.h" +#include "bench.h" + + +double +mean(const double sum, const int n) +{ + if (n) + { + return(sum / n); + } + else + { + return(0); + } +} + + +double +variance(const double sum, const double sumofsquares, const int n) +{ + double meanofsum; + + meanofsum = mean(sum, n); + + return (mean(sumofsquares,n) - (meanofsum * meanofsum)); +} + + +double +stddev(const double sum, const double sumofsquares, const int n) +{ + return(sqrt(fabs(variance(sum, sumofsquares, n)))); +} diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/statistics.h b/ACE/apps/JAWS/clients/WebSTONE/src/statistics.h new file mode 100644 index 00000000000..9f4bea75229 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/statistics.h @@ -0,0 +1,9 @@ +#ifndef _STATISTICS_H_ +#define _STATISTICS_H_ +/* $Id$ */ + +extern double mean(const double, const int); +extern double variance(const double, const double, const int); +extern double stddev(const double, const double, const int); + +#endif /* ! _STATISTICS_H_ */ diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/sysdep.c b/ACE/apps/JAWS/clients/WebSTONE/src/sysdep.c new file mode 100644 index 00000000000..f1743cab9ea --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/sysdep.c @@ -0,0 +1,51 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +#include "sysdep.h" +/* strerror() */ +#ifndef HAVE_STRERROR +/* strerror is not available on SunOS 4.1.3 and others */ +extern int sys_nerr; +extern char *sys_errlist[]; +extern int errno; + +char *strerror(int errnum) +{ + + if (errnum<sys_nerr) + { + return(sys_errlist[errnum]); + } + + return(NULL); +} + +#endif /* strerror() */ + + +/* stub routines for NT */ + +#ifdef WIN32 +#include <winsock.h> +#include <process.h> + +int getpid(void) { + + return GetCurrentThreadId(); +} + +void sleep(int sec) { + + Sleep(sec*1000); +} +#endif /* WIN32 */ + diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/sysdep.h b/ACE/apps/JAWS/clients/WebSTONE/src/sysdep.h new file mode 100644 index 00000000000..34b4df6ffc0 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/sysdep.h @@ -0,0 +1,131 @@ +#ifndef __SYSDEP_H__ +#define __SYSDEP_H__ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +/* include config.h, output from autoconf */ +#ifdef HAVE_CONFIG_H +#ifndef __CONFIG_H__ +#define __CONFIG_H__ +#include "config.h" +#endif +#endif + +#ifdef WIN32 +#include <windows.h> +#include <winsock.h> +#endif /* WIN32 */ + +/* MAXHOSTNAMELEN is undefined on some systems */ +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif + +/* SunOS doesn't define NULL */ +#ifndef NULL +#define NULL 0 +#endif + +/* encapsulation of minor UNIX/WIN NT differences */ +#ifdef WIN32 +#define NETREAD(sock, buf, len) recv(sock, buf, len, 0) +#define NETWRITE(sock, buf, len) send(sock, buf, len, 0) +#define NETCLOSE(sock) closesocket(sock) +#define BADSOCKET(sock) ((sock) == INVALID_SOCKET) +#define BADSOCKET_ERRNO(sock) BADSOCKET(sock) +#define BADSOCKET_VALUE INVALID_SOCKET +#define S_ADDR S_un.S_addr + +#ifdef USE_TIMEZONE +#error NT gettimeofday() doesn't support USE_TIMEZONE (yet) +#else +#define GETTIMEOFDAY(timeval, tz) gettimeofday(timeval) +#endif /* USE_TIMEZONE */ + +typedef unsigned short NETPORT; +#define SRANDOM srand +#define RANDOM_R rand_r +#define RANDOM rand +#define THREAD __declspec ( thread ) +#define PROGPATH "c:\\webstone\\webclient" +#define FILENAME_SIZE 256 +#define HAVE_VPRINTF 1 + +#define SIGCHLD 0 /* dummy value */ +#define SIGALRM 0 /* dummy value */ +typedef int pid_t; +typedef unsigned short ushort; +#define MAXPATHLEN 512 + + + +#else /* not WIN32 */ +#define NETREAD(sock, buf, len) read(sock, buf, len) +#define NETWRITE(sock, buf, len) write(sock, buf, len) +#define NETCLOSE(sock) close(sock) +#define BADSOCKET(sock) ((sock) < 0) +#define BADSOCKET_ERRNO(sock) (BADSOCKET(sock) || errno) +#define BADSOCKET_VALUE (-1) +#define S_ADDR s_addr + +#ifdef USE_TIMEZONE +#define GETTIMEOFDAY(timeval,tz) gettimeofday(timeval, NULL) +#else +#define GETTIMEOFDAY(timeval,tz) gettimeofday(timeval, tz) +#endif /* USE_TIMEZONE */ + +typedef unsigned short NETPORT; +#define SRANDOM srandom +#define RANDOM random +#define THREAD +#define PROGPATH "/tmp/webclient" /* "/usr/local/bin/webclient" */ +#define FILENAME_SIZE 1024 +#define HAVE_VPRINTF 1 + +typedef int SOCKET; +#define min(a,b) (((a) < (b)) ? a : b) +#define max(a,b) (((a) > (b)) ? a : b) +#endif /* WIN32 */ + + +/* function prototypes */ + +#ifdef WIN32 +int getopt(int argc, char ** argv, char *opts); +int getpid(void); +int gettimeofday(struct timeval *curTimeP); +int random_number(int max); +SOCKET rexec(const char **hostname, NETPORT port, char *username, char *password, + char *command, SOCKET *sockerr); +void sleep(int secs); + +#else +#ifdef NO_REXEC +extern int rexec(char **, int, char *, char *, char *, int *); +#endif +#endif /* WIN32 */ + + +#ifndef HAVE_STRERROR +/* strerror() is not available on SunOS 4.x and others */ +char *strerror(int errnum); + +#endif +/* strerror() */ + + +#ifndef INADDR_NONE +#define INADDR_NONE -1 +#endif + +/* !__SYSDEP_H__ */ +#endif diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/timefunc.c b/ACE/apps/JAWS/clients/WebSTONE/src/timefunc.c new file mode 100644 index 00000000000..fe38d821eac --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/timefunc.c @@ -0,0 +1,171 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +/* FUZZ: disable check_for_math_include */ +#ifndef WIN32 +#include <netdb.h> +#include <sys/time.h> +#include <sys/param.h> +#else +#include <windows.h> +#include <winsock.h> +#include <time.h> +#endif /* WIN32 */ +#include <math.h> +#include <stdio.h> +#include "sysdep.h" +#include "bench.h" + +double +timevaldouble(struct timeval *tin) +{ + return ((double)tin->tv_sec + ((double)tin->tv_usec / USECINSEC)); +} + + +void +doubletimeval(const double tin, struct timeval *tout) +{ + tout->tv_sec = (long)floor(tin); + tout->tv_usec = (long)((tin - tout->tv_sec) * USECINSEC ); +} + + +void +addtime(struct timeval *OrigTime, struct timeval *NewTime) +{ + OrigTime->tv_usec += NewTime->tv_usec; + if(OrigTime->tv_usec >= USECINSEC) + { + /* + * NEED TO CARRY 1. + */ + OrigTime->tv_sec++; + OrigTime->tv_usec -= USECINSEC; + } + OrigTime->tv_sec += NewTime->tv_sec; +} + + +void +compdifftime(struct timeval *EndTime, struct timeval *StartTime, struct timeval *DiffTime) +{ + struct timeval endtime = *EndTime; + + if((endtime.tv_usec - StartTime->tv_usec) < 0) + { + /* + * NEED TO BORROW. + */ + endtime.tv_usec += USECINSEC; + endtime.tv_sec--; + } + DiffTime->tv_usec = endtime.tv_usec - StartTime->tv_usec; + DiffTime->tv_sec = endtime.tv_sec - StartTime->tv_sec; +} + + +void +mintime(struct timeval *CurrMinTime, struct timeval *CheckMinTime) +{ + if(CheckMinTime->tv_sec < CurrMinTime->tv_sec) + { + *CurrMinTime = *CheckMinTime; + return; + } + if(CheckMinTime->tv_sec == CurrMinTime->tv_sec) + { + if(CheckMinTime->tv_usec < CurrMinTime->tv_usec) + { + *CurrMinTime = *CheckMinTime; + return; + } + } +} + + +void +maxtime(struct timeval *CurrMaxTime, struct timeval *CheckMaxTime) +{ + if(CheckMaxTime->tv_sec > CurrMaxTime->tv_sec) + { + *CurrMaxTime = *CheckMaxTime; + return; + } + if(CheckMaxTime->tv_sec == CurrMaxTime->tv_sec) + { + if(CheckMaxTime->tv_usec > CurrMaxTime->tv_usec) + { + *CurrMaxTime = *CheckMaxTime; + return; + } + } +} + +void +avgtime(struct timeval *TotalTime, int NumTimes, struct timeval *AvgTime) +{ + double meantime; + + meantime = mean(timevaldouble(TotalTime), NumTimes); + + doubletimeval(meantime, AvgTime); +} + + +void +sqtime(struct timeval *Time, struct timeval *SqTime) +{ + double sec; + + sec = timevaldouble(Time); + sec *= sec; /* square */ + + doubletimeval(sec, SqTime); +} + + +void +variancetime(struct timeval *SumTime, double SumSquareTime, int NumTimes, struct timeval *VarianceTime) +{ + double result; + + result = variance(timevaldouble(SumTime), SumSquareTime, NumTimes); + + doubletimeval(result, VarianceTime); +} + + +void +stddevtime(struct timeval *SumTime, double SumSquareTime, + int NumTimes, struct timeval *StdDevTime) +{ + double result; + + result = stddev(timevaldouble(SumTime), SumSquareTime, NumTimes); + + doubletimeval(result, StdDevTime); +} + +double +thruputpersec(const double n, struct timeval *t) +{ + double tv; + + tv = timevaldouble(t); + if (tv != 0) + return n / timevaldouble(t); + else + return 0; +} + + diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/timefunc.h b/ACE/apps/JAWS/clients/WebSTONE/src/timefunc.h new file mode 100644 index 00000000000..884aeea82d9 --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/timefunc.h @@ -0,0 +1,30 @@ +/* $Id$ */ +/************************************************************************** + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +#ifndef __TIMEFUNC_H__ +#define __TIMEFUNC_H__ + +extern double timevaldouble(struct timeval *); +extern void doubletimeval(const double, struct timeval *); + +extern void addtime(struct timeval *, struct timeval *); +extern void compdifftime(struct timeval *, struct timeval *, struct timeval *); +extern void mintime(struct timeval *, struct timeval *); +extern void maxtime(struct timeval *, struct timeval *); +extern void avgtime(struct timeval *, int, struct timeval *); +extern void variancetime(struct timeval *, double, int, struct timeval *); +extern void stddevtime(struct timeval *, double, int, struct timeval *); + +extern void sqtime(struct timeval *, struct timeval *); + +extern double thruputpersec(const double, struct timeval *); + +#endif /* !__TIMEFUNC_H__ */ diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/webclient.c b/ACE/apps/JAWS/clients/WebSTONE/src/webclient.c new file mode 100644 index 00000000000..104107ecfbe --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/webclient.c @@ -0,0 +1,1298 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +/* FUZZ: disable check_for_math_include */ + +#include <thread.h> + +#include <stdio.h> + +#ifdef WIN32 +#include <windows.h> +#include <winsock.h> +#include <time.h> +#include <process.h> +#include <io.h> +#endif /* WIN32 */ + +#include <errno.h> +#include <signal.h> +#include <stdlib.h> +#include <string.h> + +#ifndef WIN32 +#include <netdb.h> +#include <unistd.h> +#endif /* WIN32 */ + +#include <time.h> +#include <math.h> + +#ifndef WIN32 +#include <sys/param.h> +#endif /* WIN32 */ + +#include <sys/types.h> + +#ifndef WIN32 +#include <sys/ipc.h> +#include <sys/shm.h> +#include <sys/errno.h> +#include <sys/socket.h> +#include <sys/time.h> +#include <sys/wait.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#endif /* WIN32 */ + +#include <ctype.h> + +#include "sysdep.h" +#include "bench.h" + +#define _BSD_SIGNALS +#define INFINITY 100000000 +#define DEFAULTWWWPORT 80 +#define LOG_FILE "logfile" +#ifdef WIN32 +#define DEBUG_FILE "c:/tmp/webstone-debug" +#else +#define DEBUG_FILE "/tmp/webstone-debug" +#endif /* WIN32 */ +#define NCCARGS 4096 + +/* global variables */ + + THREAD FILE *debugfile = stderr; + page_list_t *load_file_list; /* actually a dynamic array */ + +int amclient = 0; +int havewebserver = 0; +int haveproxyserver = 0; +int savefile = 0; +NETPORT portnum = DEFAULTWWWPORT; +int timeexpired = 0; +int debug = 0; +long int number_of_pages = 0; +char webmaster[MAXHOSTNAMELEN]; +char webserver[MAXHOSTNAMELEN]; +char proxyserver[MAXHOSTNAMELEN]; + + +#ifdef WIN32 +HANDLE hSemaphore; +int CounterSemaphore = 0; /* counter semaphore for children */ +#endif /* WIN32 */ + +static void ClientThread(void *); + +/* used to bypass DNS/YP name resolution for every page */ +struct hostent webserv_phe, webmast_phe; +struct protoent webserv_ppe, webmast_ppe; +unsigned long webserv_addr, webmast_addr; +short webserv_type, webmast_type; /* socket type */ + +/* End of globals */ + + +static void +usage(const char *progname) +{ + returnerr("Usage: %s [-d] [-w webserver] [-p port_num]\n", + progname); + returnerr("\t[-c masterhost:port] [-t run_time | -l loops]\n"); + returnerr("\t[-n numclients] [-R]\n"); + returnerr("\t[-f config_file] [-u uilfile | url ...]\n"); + errexit("\n"); +} /* END usage() */ + +static void +alarmhandler(void) +{ + /* RECEIVED AN ALARM SIGNAL */ + timeexpired = 1; +} /* END alarmhandler() */ + +#ifndef WIN32 +static void +childhandler(void) +{ + int status; + + /* RECEIVED A SIGNAL THAT A CHILD PROCESS HAS DIED */ + D_PRINTF( "A child process has died\n" ); + while (wait3(&status, WNOHANG, (struct rusage *)0) >= 0) + { + /* do nothing */ + ; + } +} /* END childhandler() */ +#endif /* WIN32 */ + + +/* look up the host name and protocol + * called once by main() since all threads + * use the same protocol and address + */ + +int resolve_addrs(char *host, char *protocol, struct hostent *host_phe, struct protoent *proto_ppe, unsigned long *addr, + short *type) { +struct hostent *phe; +struct protoent *ppe; + + /* if IP address given, convert to internal form */ + if (host[0] >= '0' && host[0] <= '9') { + *addr = inet_addr(host); + if (*addr == INADDR_NONE) + return(returnerr("Invalid IP address %s\n", host)); + + } else { + /* look up by name */ + phe = gethostbyname(host); + if (phe == NULL) + { + D_PRINTF( "Gethostbyname failed: %s", neterrstr() ); + return(returnerr("Can't get %s host entry\n", host)); + } + memcpy(host_phe, phe, sizeof(struct hostent)); + memcpy((char *)addr, phe->h_addr, sizeof(*addr)); + } + + /* Map protocol name to protocol number */ + ppe = getprotobyname(protocol); + + if (ppe == 0) + { + D_PRINTF( "protobyname returned %d\n", ppe ); + return(returnerr("Can't get %s protocol entry\n",protocol)); + } + memcpy(proto_ppe, ppe, sizeof(struct protoent)); + + D_PRINTF( "Protocol number %d\n", ppe->p_proto ); + + /* Use protocol to choose a socket type */ + if (strcmp(protocol,"udp") == 0) + { + *type = SOCK_DGRAM; + } + else + { + *type = SOCK_STREAM; + D_PRINTF( "Choosing SOCK_STREAM %d type %d %s\n", + SOCK_STREAM, *type, neterrstr() ); + } + + return 0; +} + +/* connect to a socket given the hostname and protocol */ +SOCKET +connectsock(char *host, NETPORT portnum, char *protocol) + { + struct sockaddr_in sin; /* an Internet endpoint address */ + SOCKET s; /* socket descriptor */ + int type; /* socket type */ + short proto; + int returnval; /* temporary return value */ + + D_PRINTF( "Beginning connectsock; host=%s port=%d proto=%s\n", host, + portnum, protocol ); + + sin.sin_family = AF_INET; + memset((char *)&sin, 0, sizeof(sin)); + D_PRINTF( "Zeroed address structure\n" ); + + sin.sin_port = htons(portnum); + D_PRINTF( "Set port number %d\n", portnum ); + + /* get the contact information */ + if (strcmp(host, webserver) == 0) { + sin.sin_addr.S_ADDR = webserv_addr; + sin.sin_family = PF_INET; + proto = webserv_ppe.p_proto; + type = webserv_type; + } else if (strcmp(host, webmaster) == 0) { + sin.sin_addr.S_ADDR = webmast_addr; + sin.sin_family = PF_INET; + proto = webmast_ppe.p_proto; + type = webmast_type; + } else { + struct hostent host_phe; + struct protoent host_ppe; + unsigned long host_addr; + short host_type; /* socket type */ + + if (resolve_addrs(host, "tcp", &host_phe, &host_ppe, &host_addr, &host_type)) + return returnerr("Can't resolve hostname %s in get()\n", host); + sin.sin_addr.S_ADDR = host_addr; + sin.sin_family = PF_INET; + proto = host_ppe.p_proto; + type = host_type; + } + + /* Allocate a socket */ + s = socket(PF_INET, type, proto); + D_PRINTF( "Socket %d returned %d, %s\n", + type, s, neterrstr() ); + + if (BADSOCKET(s)) + { + D_PRINTF( "Can't create socket: %s\n",neterrstr() ); + return BADSOCKET_VALUE; + } + + /* Connect the socket */ + D_PRINTF( "Trying to connect %d with size %d, %s\n", + s, sizeof(sin), neterrstr() ); + D_PRINTF( "Address is family %d, port %d, addr %s\n", + sin.sin_family, ntohs(sin.sin_port), + inet_ntoa(sin.sin_addr) ); + + returnval = connect(s, (struct sockaddr *)&sin, sizeof(sin)); + D_PRINTF( "Connect returned %d, %s\n", + returnval, neterrstr() ); + if (returnval < 0) + { + D_PRINTF( "Can't connect: %s\n", neterrstr() ); + NETCLOSE(s); + return BADSOCKET_VALUE; + } + + /* all done, returning socket descriptor */ + D_PRINTF( "Returning %d from connectsock call\n", s ); + return(s); + +} /* END connectsock() */ + +SOCKET +connecttomaster(char *str) +{ + char *tempch; + SOCKET sock; + char msg[100]; + char ConnectStr[100]; /* Fix to handle multiple threads */ + int tries; + + strcpy(ConnectStr, str); + + /* + * BREAK UP THE connectstr INTO A HOSTNAME/HOST-IP AND A PORT NUMBER. + */ + if((tempch = strpbrk(ConnectStr,":")) == NULL) + { + /* + * INCORRECT FORMAT OF ConnectStr. CORRECT FORMAT IS + * HOSTNAME:PORT OR HOST-IP:PORT + */ + D_PRINTF( "Incorrect format %s: use hostname:port or ip_addr:port\n", + ConnectStr ); + return(returnerr("Incorrect format %s: use host:port or ip_addr:port\n", + ConnectStr)); + } + + /* + * ZERO OUT THE COLON SO WE HAVE TWO STRINGS, THE HOSTNAME AND THE PORT + */ + *tempch = '\0'; + tempch++; + + /* loop here to connect to webmaster - TCP/IP allows no more than 5 + * connection requests outstanding at once and thus the webmaster may + * reject a connection if there are a lot of client processes + */ +#define MAXTRIES 30 +#define TRYDELAY_SEC 1 + for (tries = 0; tries < MAXTRIES; tries++) { + + sock = connectsock(ConnectStr,(NETPORT)atoi(tempch),"tcp"); + + if (!BADSOCKET(sock)) + break; + + sleep(TRYDELAY_SEC); + } + + if (BADSOCKET(sock)) + { + /* ERROR CONNECTING TO MASTER PROCESS */ + return(returnerr("Could not connect to master process\n")); + } + + /* + * SIGNAL THE MASTER THAT WE ARE READY TO PROCEED. WHEN ALL + * CHILD PROCESSES HAVE CONNECTED AND SENT THIS SIGNAL, + * THE MASTER WILL ISSUE US A GO SIGNAL. + */ + if(NETWRITE(sock,READYSTR,READYSTRLEN) != READYSTRLEN) + { + return(returnerr("Error sending READY message to master")); + } + + memset(msg,0,GOSTRLEN+1); + if(NETREAD(sock,msg,GOSTRLEN) != GOSTRLEN) + { + D_PRINTF( "Error receiving GO message from master: %s\n", neterrstr() + ); + return(returnerr("Error receiving GO message from master\n")); + } + + if(strncmp(GOSTR,msg,GOSTRLEN)) + { + /* + * WE RECEIVED A MESSAGE OTHER THAN GO. PRINT IT OUT AND RETURN ERROR + */ + return(returnerr("Received non-GO message %s\n",msg)); + } + + return(sock); + +} /* END connecttomaster() */ + + +static void +accumstats(rqst_timer_t *rqsttimer, page_stats_t *pagestats, stats_t *timestat) +{ + rqst_stats_t rqststats; + +#define TFMT "%10u:%10u" + /* + * DUMP THE TIMING INFORMATION HERE, OR COMPUTE WHAT YOU WANT TO + * PRINT OUT LATER. + */ + + D_PRINTF( "Total bytes read: %d \t Body size read: %d\n", + rqsttimer->totalbytes, + rqsttimer->bodybytes ); + + D_PRINTF( "Enter time: " TFMT " \t Exit Time: " TFMT "\n", + rqsttimer->entertime.tv_sec, + rqsttimer->entertime.tv_usec, + rqsttimer->exittime.tv_sec, + rqsttimer->exittime.tv_usec ); + D_PRINTF( "Before connect: " TFMT " \t After connect: " TFMT "\n", + rqsttimer->beforeconnect.tv_sec, + rqsttimer->beforeconnect.tv_usec, + rqsttimer->afterconnect.tv_sec, + rqsttimer->afterconnect.tv_usec ); + D_PRINTF( "Before header: " TFMT " \t After header: " TFMT "\n", + rqsttimer->beforeheader.tv_sec, + rqsttimer->beforeheader.tv_usec, + rqsttimer->afterheader.tv_sec, + rqsttimer->afterheader.tv_usec ); + D_PRINTF( "After body: " TFMT "\n", + rqsttimer->afterbody.tv_sec, + rqsttimer->afterbody.tv_usec ); + + rqstat_times(&(rqststats), rqsttimer); + rqstat_sum(&(timestat->rs), &(rqststats)); + rqstat_sum(&(pagestats->rs), &(rqststats)); + + if (rqsttimer->page_number != 999) + { + timestat->page_numbers[rqsttimer->page_number] += 1; + } + +#undef TFMT +} /* END accumstats */ + + +/* + * fetch the set of files that constitute a page + * + * maxcount = the number of files in the WWW page + * pageval = the number of the WWW page (offset in load_file_list[]) + * (if -1, use page # 0 - does this still work?) + * + * returns the number of files retrieved + */ +static int +makeload(int maxcount, int pageval, THREAD rqst_timer_t *timerarray, THREAD stats_t *timestat, THREAD SOCKET mastersock, THREAD page_stats_t *page_stats) +{ + int cnt; + int returnval; + page_stats_t page_stats_tmp; + char server[MAXHOSTNAMELEN]; + + NETPORT loc_portnum; + + D_PRINTF( "Starting makeload(maxcount %d, pageval %d)\n", + maxcount, pageval ); + + strcpy( server, webserver); /* Put in default value */ + + page_stats_init(&page_stats_tmp); + D_PRINTF( "Page stats initialized\n" ); + + for (cnt = 0; cnt < maxcount; cnt++) + { + D_PRINTF( "Loop count %d in makeload()\n", cnt ); + if (pageval == -1) + { + pageval = cnt; + } + if (timeexpired) + { + break; + } + + /* check for a filename */ + if (strlen(load_file_list[pageval].filename[cnt]) < 1) + { + D_PRINTF( "Bad filename at pageval %d, count %d\n", + pageval, cnt ); + return(returnerr("Bad filename at pageval %d, count %d\n", + pageval, cnt)); + } + + /* if (load_file_list[pageval].port_number[cnt] != 0) + { + loc_portnum = load_file_list[pageval].port_number[cnt]; + } + else + { + loc_portnum = portnum; + } */ + loc_portnum = portnum; + if ((load_file_list[pageval].servername[cnt] != NULL) + && + *load_file_list[pageval].servername[cnt]) + { + D_PRINTF( "Copying URL server %s to server\n", + load_file_list[pageval].servername[cnt] ); + strcpy(server, load_file_list[pageval].servername[cnt]); + } + + if (haveproxyserver) + { + D_PRINTF( "Copying proxy %s to webserver\n", proxyserver ); + strcpy(server, proxyserver); + } + + + D_PRINTF( "Calling get(%s, %d, %s, &(timearray[%d]))\n", + server, loc_portnum, load_file_list[pageval].filename[cnt], + cnt ); + + returnval = get(server, loc_portnum, + load_file_list[pageval].filename[cnt], + &(timerarray[cnt])); + if (returnval < 0) + { + D_PRINTF( "***GET() RETURNED AN ERROR\n" ); + } + + /* + * DID GET() RETURN A VALID TIME? + */ + if ((returnval == 0) && (timerarray[cnt].valid == 2)) + { + timerarray[cnt].page_number = pageval; + + accumstats(&timerarray[cnt], &page_stats_tmp, timestat); + } + else if (!timeexpired) /* INVALID, INCREMENT THE ERROR COUNTER */ + { + D_PRINTF( "GET error counter incremented\n" ); + timestat->rs.totalerrs++; + } + + if (amclient) { + fd_set readfds; + struct timeval timeout; + int rv; + + timeout.tv_sec = 0; + timeout.tv_usec = 0; + FD_ZERO(&readfds); + FD_SET(mastersock, &readfds); + + /* if the webmaster has aborted, quit */ + D_PRINTF("Before select() on webmaster socket\n"); + if (rv = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout)) { + D_PRINTF("select() returned %d\n", rv); + D_PRINTF("Client terminating at request of webmaster\n"); + exit(2); + } + } + + } /* END for cnt */ + + /* + * DO WE HAVE A VALID RETURN FROM GET()? + * WHY NOT USE returnval HERE? + */ + if ((returnval == 0) && + (cnt == load_file_list[pageval].num_of_files) && + (timerarray[cnt-1].valid == 2)) + { + rqst_stats_t *ps_rs; + rqst_stats_t *pst_rs; + + ps_rs = &(page_stats[pageval].rs); + pst_rs = &(page_stats_tmp.rs); + + rqstat_sum(ps_rs, pst_rs); + + page_stats[pageval].totalpages++; + + if (page_stats[pageval].page_size == 0) + { + page_stats[pageval].page_size = (unsigned) + page_stats_tmp.rs.totalbody; + } + } + + D_PRINTF( "\nMakeload output page %d: %d errors, %d pages\n", + pageval, timestat->rs.totalerrs, page_stats[pageval].totalpages ); + D_PRINTF( "Makeload returning %d\n", cnt ); + + return(cnt); + +} /* END makeload() */ + +#ifdef WIN32 +/* close socket library at exit() time */ +void sock_cleanup(void) { + + WSACleanup(); +} +#endif /* WIN32 */ + +/* globalize variables that were in main() */ +long int numfiles = 0; +int testtime = 0; +int numloops = 0; +int numclients = 0; +int record_all_transactions = 0; +int uil_filelist_f = 0; /* filedescriptor of URLs to fetch? */ +int verbose = 0; +int total_weight; +char uil_filelist[NCCARGS]; +char filelist[MAXNUMOFFILES][MAXPATHLEN]; +char configfile[MAXPATHLEN]; +char connectstr[MAXHOSTNAMELEN+10]; + +void +main(int argc, char *argv[]) +{ + int file_count=0; + int getoptch; + int currarg; + extern char *optarg; + extern int optind; + int i, j; + char *tempch; + int err; + +#define SLEEP_USEC 100 +#ifdef WIN32 + WSADATA WSAData; +#else + + struct timeval sleeptime; + + /* set the amount of time that we'll pause before sending a "." to the + webmaster */ + + sleeptime.tv_sec = SLEEP_USEC/1000000; + sleeptime.tv_usec = SLEEP_USEC % 1000000; +#endif /* WIN32 */ + + debugfile = stderr; + +#ifdef WIN32 + MessageBeep(~0U); /* announce our existence */ + MessageBeep(~0U); + MessageBeep(~0U); + + err = WSAStartup(MAKEWORD(1,1), &WSAData); + if (err != 0) { + errexit("Error in WSAStartup()\n"); + } + + atexit(sock_cleanup); + + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); + + /* create semaphore in locked state */ + hSemaphore = CreateSemaphore(NULL, 0, 1, NULL); + if(hSemaphore == NULL) + { + errexit("Create semaphore failed: %d", GetLastError()); + } +#endif /* WIN32 */ + + memset(webserver, 0, sizeof(webserver)); + memset(webmaster, 0, sizeof(webmaster)); + memset(proxyserver, 0, sizeof(proxyserver)); + memset(connectstr, 0, sizeof(connectstr)); + + /* + * PARSE THE COMMAND LINE OPTIONS + */ + + while((getoptch = getopt(argc,argv,"P:f:t:l:p:u:R:w:c:n:sdv")) != EOF) + { + switch(getoptch) + { + case 'c': + sprintf(connectstr, "%s", optarg); + amclient = 1; + printf("%s", OKSTR); /* sent back to webmaster */ + fflush(stdout); + break; + case 'd': + debug = 0; /* sumedh */ + break; + case 'f': + sprintf(configfile, "%s", optarg); + break; + case 'l': + numloops = atoi(optarg); + break; + case 'n': + numclients = atoi(optarg); + break; + case 'u': + sprintf(uil_filelist, "%s", optarg); + uil_filelist_f = 1; + break; + case 'p': + portnum = atoi(optarg); + break; + case 's': + savefile = 1; + break; + case 't': + testtime = 60 * atoi(optarg); + break; + case 'v': + verbose = 1; + break; + case 'w': + havewebserver = 1; + sprintf(webserver,"%s",optarg); + break; + case 'P': + haveproxyserver = 1; + sprintf(proxyserver, "%s", optarg); + break; + case 'R': + record_all_transactions = 1; + break; + default: + usage(argv[0]); + } + } + + returnerr("Client begins...\n"); + D_PRINTF( "Running in debug mode\n\n" ); + + /* print the command line */ + for (i = 0; i < argc; i++) + D_PRINTF( "%s ", argv[i] ); + D_PRINTF( "\n\n" ); + + if(testtime && numloops) + { + /* + * EITHER numloops OR testtime, BUT NOT BOTH. + */ + usage(argv[0]); + } + + if(havewebserver != 1) + { +#ifdef WIN32 + /* + * THE SERVER'S NAME MUST BE SPECIFIED + */ + returnerr("No WWW Server specified\n"); + usage(argv[0]); +#else + /* IF IT ISN'T, WE ASSUME LOCALHOST */ + sprintf(webserver, "%s", "localhost"); + havewebserver = 1; +#endif /* WIN32 */ + } + + currarg = optind; + numfiles = 0; + while(currarg != argc) + { + /* + * GET THE URLS TO RETRIEVE. + */ + if (numfiles == MAXNUMOFFILES) { + returnerr("Maximum of %d files on the command line.\n"); + usage(argv[0]); + } + sscanf(argv[currarg],"%s",filelist[numfiles]); + numfiles++; + currarg++; + } + + if ((numfiles != 0) && uil_filelist_f) + { + returnerr("Both a filelist and UIL specified.\n"); + usage(argv[0]); + } + + if((numfiles == 0) && !(uil_filelist_f)) + { + /* + * AT LEAST ONE FILE MUST BE SPECIFIED + */ + returnerr("No UIL resources or filelist specified \n"); + usage(argv[0]); + } + + if((numloops == 0) && (testtime == 0)) + { + /* + * NO SPECIFIED NUMBER OF LOOPS, AND NO TEST TIME + */ + usage(argv[0]); + } + if(numclients > MAXPROCSPERNODE || numclients < 1) + { + returnerr("Number of Clients must be between 1 and %d\n", MAXPROCSPERNODE); + exit(1); + } + + /* allow use of IP address */ + if(amclient) { + if((tempch = strpbrk(connectstr,":")) == NULL) + { + /* + * INCORRECT FORMAT OF ConnectStr. CORRECT FORMAT IS + * HOSTNAME:PORT OR HOST-IP:PORT + */ + D_PRINTF( "Incorrect format %s: use hostname:port or ip_addr:port\n", + connectstr ); + returnerr("Incorrect format %s: use host:port or ip_addr:port\n", connectstr); + exit(1); + } else { + strncpy(webmaster, connectstr, tempch-connectstr); + } + if(resolve_addrs(webmaster, "tcp", &webmast_phe, &webmast_ppe, &webmast_addr, &webmast_type)) + exit(1); + } + + if (haveproxyserver) + { + D_PRINTF( "Copying proxy %s to webserver\n", proxyserver ); + strcpy(webserver, proxyserver); + } + + if (resolve_addrs(webserver, "tcp", &webserv_phe, &webserv_ppe, &webserv_addr, &webserv_type)) + exit(1); + + /* + * INITIALIZE DATA + */ + /* allocate space for dynamic arrays */ + load_file_list = + (page_list_t *)mymalloc((MAXNUMOFPAGES)*sizeof(page_list_t)); + + if (uil_filelist_f) + { + /* take a guess at the number of URLs in the file */ + D_PRINTF( "About to parse filelist %s\n", uil_filelist ); + number_of_pages = count_file_list(uil_filelist); + numfiles = 1; + + /* IF WE HAVE A FILELIST, PARSE IT */ + /* allocate memory */ + D_PRINTF( "Allocating page list: %ld by %d\n", + number_of_pages, numfiles ); + for (i=0; i<number_of_pages; i++) + { + for (j=0; j<MAXNUMOFFILES; j++) + { + load_file_list[i].servername[j] = + (char *)mymalloc(URL_SIZE); + load_file_list[i].filename[j] = + (char *)mymalloc(URL_SIZE); + } + } + + D_PRINTF( "Parsing file list: %s\n", uil_filelist ); + parse_file_list(uil_filelist, load_file_list, + &number_of_pages, &numfiles); + /* free memory for pages that won't be used? */ + D_PRINTF( "Actual page list: %ld by %d\n", + number_of_pages, MAXNUMOFFILES ); + + D_PRINTF( "Setting up weighting for %ld pages\n", + number_of_pages ); + total_weight = load_percent(load_file_list, number_of_pages); + /* total_weight = load_percent(load_file_list, number_of_pages, pages); */ + } + else + { + /* no uil file */ + number_of_pages = numfiles; + } + + if (number_of_pages < 1) + { + /* no pages - exit */ + D_PRINTF( "No valid URLs found\n" ); + errexit("No valid URLs found\n"); + } + +#ifndef WIN32 + /* + * IF WE ARE TO FORK ADDITIONAL CLIENTS ON THIS MACHINE, + * WE MUST DO IT BEFORE WE CONNECT TO THE MASTER. + * + * FIRST, SET UP SIGNAL HANDLING + */ + signal(SIGCHLD, childhandler); + for(i = 0; i < numclients; i++) + { + thr_create (NULL, NULL, ClientThread, NULL, THR_BOUND, NULL); + + /* switch(fork()) + { + case 0: + numclients = 1; + ClientThread(NULL); + exit(0); + break; + case -1: + errexit("Error forking child processes\n"); + exit(1); + default: + break; + } */ + select(0,(fd_set *)0,(fd_set *)0, (fd_set *)0, &sleeptime); + } + + /* + * Wait for all children to exit. + */ + + while (thr_join(NULL, NULL, NULL) == 0); + + /* for(;;) + { + int pid = wait((int*)0); + if ((pid == -1) && errno == ECHILD) break; + } */ +#else + /* start threads on NT */ + for (i = 0; i < numclients; i++) + { + if (_beginthread(ClientThread, 0, NULL) == -1) + { + errexit("_beginthread failed: %d", GetLastError()); + } + } +#endif /* WIN32 */ + +#ifdef WIN32 + /* wait for children to get to sync point */ + while (CounterSemaphore < numclients) + sleep(1); + CounterSemaphore = 0; + + /* start all children simultaneously */ + ReleaseSemaphore(hSemaphore, 1, NULL); + + if (testtime) { + sleep(testtime); + alarmhandler(); /* signal end of test to threads */ + } + + /* + * Wait for all threads to exit. + */ + while (CounterSemaphore < numclients) + sleep(1); + + CloseHandle(hSemaphore); +#endif /* WIN32 */ + + return; +} /* end main() */ + +void ClientThread(void *dummy) +{ + + THREAD FILE *logfile; + + THREAD stats_t timestat; + + THREAD rqst_timer_t timerarray[MAXNUMOFFILES]; + THREAD SOCKET mastersock = BADSOCKET_VALUE; /* connection to webmaster */ + + + THREAD page_stats_t *page_stats; /* actually a dynamic array */ + + int loopcnt = 0; + int filecnt; + int loop; + int ran_number; + int page_index; + int page_number; + int file_count = 0; + char file_name[50]; + struct timeval runningtime; + time_t junk; + int i; + int returnval; + + /* + * INITIALIZE DATA + */ + + page_stats = + (page_stats_t *)mymalloc((number_of_pages)*sizeof(page_stats_t)); + + for (i=0; i < number_of_pages; i++) { + page_stats_init(&(page_stats[i])); + } + + if (debug) + { + /* + * OPEN A DEBUG FILE + */ + fflush(stderr); + sprintf(file_name, "%s.%d", DEBUG_FILE, (int)getpid()); + debugfile = fopen(file_name, "w+"); + if (debugfile == NULL) + errexit("Can't open debug file\n"); + D_PRINTF( "Running in debug mode, %d\n",amclient ); + } + + if (record_all_transactions) + { + /* + * OPEN A LOG FILE. + */ + sprintf(file_name, "%s%d", LOG_FILE, (int)getpid()); + returnerr("Log file is %s\n", file_name); + logfile = fopen(file_name, "w+"); + } + + /* Initialize random number generator */ + junk = getpid (); + rand_r(&junk); + D_PRINTF( "Random seed: %d\n", junk ); + + for (i=0; i < MAXNUMOFFILES; i++) + { + rqtimer_init(&(timerarray[i])); + } + stats_init(×tat); + + D_PRINTF( "Number of files %d\n", numfiles ); + + timestat.total_num_of_files = numfiles; + + if (amclient) + { + /* + * WE ARE A CLIENT PROCESS. (i.e. WE ARE NOT RUN BY A USER, BUT BY + * THE MASTER WWWSTONE PROCESS. WE NEED TO CONNECT TO THE + * MASTER WHO WILL SYNCHRONIZE ALL THE CLIENTS. + */ + D_PRINTF( "Trying to connect with %s\n",connectstr ); + + mastersock = connecttomaster(connectstr); + + D_PRINTF( "connecttomaster returns %d, %s\n", + mastersock, neterrstr() ); + + if(BADSOCKET(mastersock)) + { + /* + * ERROR CONNECTING TO THE MASTER. ABORT. + */ + errexit("Error connecting to the master: %s\n", neterrstr()); + } + } /* END IF CLIENT */ + +#ifdef WIN32 + /* Tell parent we're ready */ + InterlockedIncrement(&CounterSemaphore); + + /* Wait for main() thread to release us */ + WaitForSingleObject(hSemaphore, INFINITE); + ReleaseSemaphore(hSemaphore, 1, NULL); +#endif /* WIN32 */ + if (testtime != 0) + { + /* + * IF RUNNING A TIMED TEST, WE WILL LOOP + * UNTIL THE ALARM GOES OFF. + * WE'LL ALSO NEED TO SET THE SIGNAL HANDLER + */ +#ifndef WIN32 + /*signal(SIGALRM, alarmhandler);*/ + /* + * SEND SIGALRM IN testtime SECONDS + */ + /*alarm(testtime);*/ +#endif /* WIN32 */ + } + + /* + * AND THEY'RE OFF... + */ + + if (testtime) + numloops = INFINITY; + GETTIMEOFDAY(&(timestat.starttime), &(timestat.starttimezone)); + + /* LOOP UNTIL WE HIT numloops, OR WE RUN OUT OF TIME */ + for(loopcnt = 0; (loopcnt < numloops) && !timeexpired; loopcnt++) + { + /* + * THIS IS WHERE LOAD TESTING IS DONE. + * GET A RANDOM NUMBER, THEN INDEX INTO THE + * PAGE, AND THEN REQUEST THAT SET OF FILES. + */ + if (uil_filelist_f) /* HAVE FILELIST */ + { + D_PRINTF( "Have filelist\n" ); + /* if (testtime != 0) /* RUNNING IN TIMED MODE */ + if (1) + { + D_PRINTF( "Running in timed mode\n" ); + /* random number between 0 and totalweight-1 */ + junk = getpid (); + ran_number = (rand_r(&junk) % total_weight); + D_PRINTF( "random %ld\n", ran_number ); + + /* loop through pages, find correct one + * while ran_number is positive, decrement it + * by the load_num of the current page + * example: ran_number is 5, pages have weights of 10 and 10 + * first iteration page_index = 0, ran_number = -5 + * iteration halted, page_index = 0 + */ + page_index = -1; + while (ran_number >= 0) + { + page_index++; + D_PRINTF( "Current page index %d: %ld - %d\n", + page_index, ran_number, + load_file_list[page_index].load_num + ); + ran_number -= load_file_list[page_index].load_num; + } + + if (page_index >= number_of_pages) { page_index--; } + + D_PRINTF( "Final page index %d\n", page_index ); + filecnt = makeload(load_file_list[page_index].num_of_files, + page_index, timerarray, ×tat, mastersock, page_stats); + testtime = 1; + } + else /* NOT RUNNING IN TIMED MODE */ + { + for (page_number = 0; + page_number < number_of_pages; + page_number++) + { + filecnt = makeload(load_file_list[page_number].num_of_files, + page_number, timerarray, ×tat, mastersock, page_stats); + + } /* END for page_number */ + } /* END if/else TIMED MODE */ + } + else /* NO FILELIST */ + { + D_PRINTF( "No filelist\n" ); + /* + * LOOP THROUGH UNTIL numfiles TIMES OR UNTIL TIMER EXPIRES + * AND ALARM SETS filecnt TO INFINITY. + */ + + /* does this still work?? */ + /* filecnt = makeload(numfiles, -1, timerarray); */ + } /* END if HAVE FILELIST */ + + if (filecnt > 0) + file_count += filecnt; + + } /* END while loopcnt */ + + GETTIMEOFDAY(&(timestat.endtime), &(timestat.endtimezone)); + D_PRINTF( "Test run complete\n" ); + signal(SIGALRM, NULL); + + if (testtime == 0) + { + numfiles = loopcnt; + + if (uil_filelist_f) + { + numfiles = file_count; + } + } + + /* This option ( "-R" ) looks broken (e.g. l > 50) -- JEF 2/15/96 */ + if (record_all_transactions) + { + /* + * DUMP THE LOG FILE INFORMATION. + */ + for (loop=0; loop < (loopcnt * file_count); loop++) + { + fprintf(logfile, " entertime \t%d.%d\n" + " beforeconnect \t%d.%d\n" + " afterconnect \t%d.%d\n" + " beforeheader \t%d.%d\n" + " afterheader \t%d.%d\n" + " afterbody \t%d.%d\n" + " exittime \t%d.%d\n" + " total bytes \t%d\n" + " body bytes\t%d\n", + timerarray[loop].entertime.tv_sec, + timerarray[loop].entertime.tv_usec, + timerarray[loop].beforeconnect.tv_sec, + timerarray[loop].beforeconnect.tv_usec, + timerarray[loop].afterconnect.tv_sec, + timerarray[loop].afterconnect.tv_usec, + timerarray[loop].beforeheader.tv_sec, + timerarray[loop].beforeheader.tv_usec, + timerarray[loop].afterheader.tv_sec, + timerarray[loop].afterheader.tv_usec, + timerarray[loop].afterbody.tv_sec, + timerarray[loop].afterbody.tv_usec, + timerarray[loop].exittime.tv_sec, + timerarray[loop].exittime.tv_usec, + timerarray[loop].totalbytes, + timerarray[loop].bodybytes); + } /* end for loop */ + } /* end if recording all transactions */ + + D_PRINTF( "total errors: %d\n",timestat.rs.totalerrs ); + /* gethostname(timestat.hostname,MAXHOSTNAMELEN); */ + /* D_PRINTF( "Test for host: %s\n",timestat.hostname ); */ + D_PRINTF( "Server is: %s running at port number: %d\n", + webserver,portnum ); + + /* sprintf(timestat.hostname,"%s:%d",timestat.hostname,getpid()); */ + if (amclient) /* CLIENT TO A WEBMASTER */ + { + char *stats_as_text; + + /* + * SEND THE TIMING DATA TO THE MASTER + */ + stats_as_text = stats_to_text(×tat); + D_PRINTF( "stats_to_text returned %s\n", stats_as_text ); + + returnval = senddata(mastersock, stats_as_text, + SIZEOF_STATSTEXTBASE + number_of_pages*SIZEOF_DOUBLETEXT); + D_PRINTF( "Wrote time stats to master %d\n", returnval ); + + if (returnval < 1) + { + D_PRINTF( "Error while writing time stats: %s\n", + neterrstr() ); + errexit("Error while writing time stats: %s\n", + neterrstr()); + } + + if (uil_filelist_f) + /* write pagestats */ + { + char *page_stats_as_text; + for (i = 0; i < number_of_pages; i++) + { + D_PRINTF( "On page_stats[%d]\n", i ); + page_stats_as_text = page_stats_to_text(&page_stats[i]); + returnval = strlen(page_stats_as_text); + D_PRINTF( "page_stats_to_text[%d] returned %d\n", + i, returnval ); + returnval = senddata(mastersock, page_stats_as_text, + SIZEOF_PAGESTATSTEXT); + if (returnval < 1) + { + D_PRINTF( "Error while writing page_stats[%d]: %s\n", + i, neterrstr() ); + errexit("Error while writing page_stats[%d]: %s\n", + i, neterrstr()); + } /* end if */ + D_PRINTF( "Wrote %d bytes of page_stats[%d] to master\n", + returnval, i ); + } /* end for */ + } /* end if filelist */ + + D_PRINTF( "About to close socket\n" ); + if (NETCLOSE(mastersock)) + D_PRINTF( "Close socket error: %s\n", neterrstr() ); + } + else /* NOT A CLIENT TO A WEBMASTER */ + { + if (testtime) + { + printf("Test ran for: %d minutes\n",(testtime/60)); + } + else + { + printf("Test ran for: %d iterations.\n",numloops); + } + compdifftime(&(timestat.endtime), &(timestat.starttime), + &(runningtime)); + printf("Total time of test (sec) %d.%d\n", runningtime.tv_sec, + runningtime.tv_usec); + printf("Files retrieved per iteration: %d\n",numfiles); /* 'per iteration' */ + printf("----------------------------------\n"); + printf("Totals:\n\n"); + rqstat_print(&(timestat.rs)); + + if (timestat.rs.totalconnects == 0) + goto end; + printf("Thruput = %5.2lf Kbytes/sec\n", + thruputpersec(timestat.rs.totalbytes, &runningtime) / 1000); + + if (uil_filelist_f && numloops && verbose) + { + for (loop = 0; loop < number_of_pages; loop++) + { + if (timestat.page_numbers[loop] != 0) + { + printf ("===============================================================================\n"); + printf ("Page # %d\n\n", loop); + printf ("Total number of times page was hit %d\n", + page_stats[loop].totalpages); + rqstat_print(&(page_stats[loop].rs)); + printf ("Page size %d \n", page_stats[loop].page_size); + printf ("===============================================================================\n\n"); + } /* END if timestat */ + } /* END for loop */ + } /* END if filelist */ + } /* END if client */ + +end: + if(record_all_transactions) + fclose(logfile); + if(debug) + { + D_PRINTF( "Client exiting.\n" ); + fclose(debugfile); + } + +#ifdef WIN32 + /* tell parent we're done */ + InterlockedIncrement(&CounterSemaphore); +#endif /* WIN32 */ + +} /* END ClientThread() */ diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/webmaster.c b/ACE/apps/JAWS/clients/WebSTONE/src/webmaster.c new file mode 100644 index 00000000000..b6d595ce32d --- /dev/null +++ b/ACE/apps/JAWS/clients/WebSTONE/src/webmaster.c @@ -0,0 +1,1418 @@ +/* $Id$ */ +/************************************************************************** + * * + * Copyright (C) 1995 Silicon Graphics, Inc. * + * * + * These coded instructions, statements, and computer programs were * + * developed by SGI for public use. If any changes are made to this code* + * please try to get the changes back to the author. Feel free to make * + * modifications and changes to the code and release it. * + * * + **************************************************************************/ + +/* FUZZ: disable check_for_math_include */ +#include <stdio.h> +#include <errno.h> +#include <signal.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#ifndef WIN32 +#include <unistd.h> +#endif /* WIN32 */ + +#include <math.h> + +#ifndef WIN32 +#include <sys/param.h> +#include <sys/types.h> +#include <sys/errno.h> +#include <sys/socket.h> +#include <sys/time.h> +#include <netinet/in.h> +#include <netdb.h> +#else +#define FD_SETSIZE 1024 /* max size for select() - keep before <winsock.h> + * and same size as MAXCLIENTS */ +#include <windows.h> +#include <winsock.h> +#include <io.h> +#include <process.h> +#endif /* WIN32 */ + +#include "sysdep.h" +#include "bench.h" + +/* command line options/data */ +int savefile = 0; +int debug = 0; +int norexec = 0; +int haveproxyserver = 0; +char proxyserver[MAXHOSTNAMELEN]; +char network_mask_str[30] = "255.255.255.0"; +unsigned network_mask = 0; +int servaddrin_config = 0; +int dumpall = 0; +int testtime = 0; +int havewebserver = 0; +int numloops = 0; +NETPORT portnum = 0; +int redirect = 0; +int record_all_transactions = 0; +int uil_filelist_f = 0; +int verbose = 0; +char webserver[MAXHOSTNAMELEN]; +char configfile[MAXPATHLEN]; +char uil_filelist[NCCARGS]; + +char filelist[256][MAXPATHLEN]; +fd_set zerofdset; + +/* other key data */ +long int number_of_pages = 0; +int totalnumclients = 0; +int num_rexecs = 0; +SOCKET socknum[MAXCLIENTS]; +SOCKET sockIO[MAXTOTALPROCS]; +SOCKET sockErr[MAXTOTALPROCS]; +THREAD FILE *debugfile = stderr; +struct hostent *master_phe; /* IP addresses for webmaster */ +struct timeval sumedh_start, sumedh_end; + +void HostEntCpy(struct hostent *dest, struct hostent *src); + +static void +usage(const char *progname) +{ + + fprintf(stderr, "Usage: %s [-a] [-d] -f config_file [-l numloops]\n", + progname); + fprintf(stderr, " [-p port_num] [-r] [-s] [-t run_time] \n"); + fprintf(stderr, "\n"); + fprintf(stderr, "-w webserver URL [URL ...]\n\n"); + fprintf(stderr, "-a print timing information for all clients\n"); + fprintf(stderr, "-d turn on debug statements\n"); + fprintf(stderr, "-f config_file\tfile specifying clients\n"); + fprintf(stderr, "-l number of iterations to retrieve uils\n"); + fprintf(stderr, "-p port number of web server if not 80\n"); + fprintf(stderr, "-r redirect stdout of clients to /tmp/webstone.xxx\n"); + fprintf(stderr, "-s save client gets to /tmp/webstone.data.*\n"); + fprintf(stderr, "-t run_time\tduration of test in minutes\n"); + fprintf(stderr, "-w webserver\tname of webserver host to contact\n"); + fprintf(stderr, "-u URL file\tfilelist of URLs\n"); + fprintf(stderr, "-v verbose mode\n"); + fprintf(stderr, "-P servername\tuse proxy server for transactions\n"); + fprintf(stderr, "-W webserver addresses are in the config file\n"); + fprintf(stderr, "-R record all transactions\n"); + errexit("\n"); +} + +static SOCKET +passivesock(const NETPORT portnum, const char *protocol, const int qlen) +{ + struct protoent *ppe; /* pointer to protocol info entry */ + struct sockaddr_in sin; /* Internet endpoint address */ + SOCKET s; /* socket descriptor */ + int type; /* socket type */ + + D_PRINTF( "Beginning passivesock with errno %d\n",errno ); + + D_PRINTF( "Zeroing address structure\n" ); + memset((char *)&sin, 0, sizeof(sin)); + + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = INADDR_ANY; + + /* NOT USED: Map service name to portnumber */ + D_PRINTF( "Mapping portnum errno %d\n",errno ); + sin.sin_port = htons(portnum); + + /* Map protocol name to number */ + D_PRINTF( "Mapping protocol name errno %d\n",errno ); + if ((ppe = getprotobyname(protocol)) == 0) + { + errexit("Can't get \"%s\" protocol entry\n", protocol); + } + errno = 0; + + /* use protocol to choose socket type */ + D_PRINTF( "Changing socket type, errno %d\n",errno ); + if (strcmp(protocol, "udp") == 0) + { + type = SOCK_DGRAM; + D_PRINTF( "Choosing SOCK_DGRAM\n" ); + } + else + { + type = SOCK_STREAM; + D_PRINTF( "Choosing SOCK_STREAM, errno %d\n",errno ); + } + + /* allocate a socket */ + s = socket(PF_INET, type, ppe->p_proto); + if (BADSOCKET(s)) + { + D_PRINTF( "Socket PF_INET %d %d returned %d with %s\n", + type, ppe->p_proto, s, neterrstr() ); + errexit("Can't create socket: %s\n", neterrstr()); + } + D_PRINTF( "Socket %d created with errno %d\n",s,errno ); + + /* Bind the socket */ + if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) + { + errexit("Can't bind to port %d: %s\n", portnum, neterrstr()); + } + D_PRINTF( "Bind succeeded\n" ); + + /* If it's a stream, listen for connections */ + /* NOTE: ON NT, the listen() backlog parm is silently limited to 5 conns */ + if ((type == SOCK_STREAM) && BADSOCKET(listen(s, qlen))) + { + errexit("Can't listen on port %s: %s\n", portnum, neterrstr()); + } + D_PRINTF( "Listen succeeded\n" ); + + /* all done, return socket descriptor */ + return(s); +} + + +/* abort clients -- called by SIGINT handler */ +static void abort_clients(void) +{ + /* Not supposed to have fprintf in a signal handler, but... */ + fprintf(stdout, "Webmaster received SIGINT. Terminating.\n"); + /* exit will close all open connections */ + exit(2); +} + +/* signal handler for SIGINT */ +static void sig_int(int sig) { + + abort_clients(); +} + +#ifdef WIN32 + +/* echo stdout/stderr from clients */ +void echo_client(void *stream) +{ + SOCKET *sockarr; + FILE *outfile; + int which_stream = (int) stream; + char buf[BUFSIZ]; + int i, len, rv; + fd_set readfds; + + /* This code which handles the timeout may need + to be ifdef'ed for WIN32 */ + struct timeval timeout; + + timeout.tv_sec = (long)5; + timeout.tv_usec = (long)0; + + if (which_stream) { + sockarr = sockIO; + outfile = stdout; + } else { + sockarr = sockErr; + outfile = stderr; + } + + D_PRINTF( "echo_client running\n" ); + signal( SIGINT, SIG_DFL); /* restore default behavior + for SIGINT */ + + while (1) { + FD_ZERO(&readfds); + for (i = 0; i < num_rexecs; i++) + if (sockarr[i] != BADSOCKET_VALUE) + FD_SET(sockarr[i], &readfds); + rv = select(num_rexecs, &readfds, NULL, NULL, &timeout); + if ( rv == 0) + continue; + if (rv < 0 && WSAGetLastError() == WSANOTINITIALISED) + return; + if (rv < 0) + errexit("Error in echo_client(): select() returns %d: %s\n", rv, neterrstr()); + + /* loop over the sockets that are ready with data */ + for (i = 0; i < num_rexecs; i++) { + if (sockarr[i] != BADSOCKET_VALUE && FD_ISSET(sockarr[i], &readfds)) { + len = NETREAD(sockarr[i], buf, sizeof(buf)); + if (len <= 0) { + /* mark connection closed */ + sockarr[i] = BADSOCKET_VALUE; + if (len < 0 && WSAGetLastError() == WSANOTINITIALISED) + return; + if (len < 0) + fprintf(stderr, "Error in echo_client() after NETREAD(): %s\n", neterrstr()); + continue; + } + + /* copy to stdout or stderr */ + fwrite(buf, sizeof(char), len, outfile); + } + } + } + D_PRINTF( "Exiting echo_client\n" ); +} + +#else +static int +echo_client(char *hostname, const int fd) +{ + /* + * WRITE TEXT FROM FILE DESCRIPTOR INTO STDOUT + */ + char buf[BUFSIZ]; + int cc; + D_PRINTF( "echo_client running\n" ); + + while (getppid() != 1) + { + cc = NETREAD(fd, buf, sizeof(buf)); + if (cc > 0) + { + write(STDOUT_FILENO, buf, cc); + } + } + D_PRINTF( "Exiting echo_client\n" ); + NETCLOSE(fd); +} +#endif /* WIN32 */ + +/* Picks the appropriate webmaster IP address based on the address of the client. + * This is significant only for hosts with multiple interfaces + * + * return value is a string with the IP address or hostname (or NULL) + */ +char *pick_webmaster_IP_address(char *client_hostname, struct hostent *master_phe, + unsigned netmask) { +static char buf[20]; +unsigned char addr[4]; +int client_addr; +int i; + + if (client_hostname[0] >= '0' && client_hostname[0] <= '9') { + /* we have an IP address */ + client_addr = inet_addr(client_hostname); + if (client_addr == INADDR_NONE) + return NULL; + } else { + /* we have a hostname, use the webserver hostname */ + return master_phe->h_name; + } + + for (i = 0; master_phe->h_addr_list[i] != NULL; i++) { + if ((*(int *)(master_phe->h_addr_list[i]) & netmask) == + (client_addr & netmask)) + goto gotit; + } + i = 0; /* give up */ + +gotit: + memcpy((char *)addr, master_phe->h_addr_list[i], sizeof(addr)); /* Internet specific */ + sprintf(buf, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]); + return buf; +} + +/* + Command line parsing +*/ + +void ParseCmdLine(int argc, char **argv ) +{ +char getoptch; +int currarg; +extern char *optarg; +extern int optind; + + /* + * PARSE THE COMMAND LINE OPTIONS + */ + while((getoptch = getopt(argc,argv,"P:f:t:l:p:u:R:w:n:M:adrsvWX")) != (const char)EOF) + { + switch(getoptch) + { + case 'M': + strcpy(network_mask_str, optarg); + break; + case 'P': + haveproxyserver = 1; + strcpy(proxyserver, optarg); + break; + case 'R': + record_all_transactions = 1; + break; + case 'X': + norexec = 1; + break; + case 'W': + servaddrin_config = 1; + break; + case 'a': + dumpall = 1; + break; + case 'd': + debug = 1; + break; + case 'f': + strcpy(configfile, optarg); + break; + case 'l': + numloops = atoi(optarg); + break; + case 'p': + portnum = atoi(optarg); + break; + case 'r': + redirect = 1; + break; + case 's': + savefile = 1; + break; + case 't': + testtime = atoi(optarg); + break; + case 'u': + uil_filelist_f = 1; + strcpy(uil_filelist, optarg); + break; + case 'v': + verbose = 1; + break; + case 'w': + havewebserver = 1; + strcpy(webserver, optarg); + break; + default: + usage(argv[0]); + } /* end switch */ + } /* end while */ + + if (numloops && testtime) + errexit("Can't have both -l and -t\n"); + + if(!havewebserver && !servaddrin_config) + { + /* + * THE SERVERS NAME MUST BE SPECIFIED + */ + + fprintf(stderr,"No WWW Server specified\n"); + usage(argv[0]); + } + + if (havewebserver && servaddrin_config) + { + /* + * CAN'T HAVE BOTH -w and -W + */ + fprintf(stderr, "Can't have both -w and -W options\n"); + usage(argv[0]); + } + + network_mask = inet_addr(network_mask_str); + if (network_mask == INADDR_NONE) { + fprintf(stderr, "Invalid network mask (-M %s)\n", network_mask_str); + usage(argv[0]); + } + + if(strlen(configfile) == 0) + { + /* + * THE MASTER MUST HAVE A CONFIGURATION FILE TO READ. + */ + fprintf(stderr,"No Configuration file specified\n"); + usage(argv[0]); + } + /* IF WE DO NOT HAVE A FILE LIST THEN THERE ARE UIL'S AT THE END OF THE + * COMMAND LINE SO GRAB THEM. + */ + if (uil_filelist_f == 0) + { + currarg = optind; + number_of_pages = 0; + while(currarg != argc) + { + /* + * GET THE UILS TO RETRIEVE. + */ + + sscanf(argv[currarg],"%s",filelist[number_of_pages]); + number_of_pages++; + currarg++; + } + } + else + { + /* have filelist; take a stab at the number of valid URLs */ + D_PRINTF( "About to parse filelist %s\n", uil_filelist ); + number_of_pages = count_file_list(uil_filelist); + } + if (number_of_pages == 0) + { + /* + * AT LEAST ONE FILE MUST BE SPECIFIED + */ + fprintf(stderr,"No URL resources specified\n"); + usage(argv[0]); + } +} + +/* + This function sets up the socket we will use to synchronize with the + clients. + Returns the socket number if successful, doesn't return if it fails +*/ + +SOCKET SetupSyncSocket( serveraddr ) +struct sockaddr_in *serveraddr; +{ + int sock,len; + + /* + * SET UP THE SOCKET WE ARE GOING TO USE TO SYNCHRONIZE WITH THE CLIENTS. + */ + D_PRINTF( "About to call sock %d %d\n", portnum, MAXCLIENTS ); + + sock = passivesock(0, "tcp", MAXCLIENTS); + + if (BADSOCKET(sock)) + { + errexit("Couldn't open socket %d: %s\n", sock, neterrstr()); + } + D_PRINTF( "The passivesock call succeeded\n" ); + + D_PRINTF( "calling getsockname\n" ); + + len = sizeof(struct sockaddr); + if(getsockname(sock, (struct sockaddr *)serveraddr, &len) < 0) + { + errexit("Could not get socket informaton\n"); + } + + return( sock ); +} + +/* + Function which generates a commandline for the webclients +*/ +void MakeCmdLine( commandline) +char *commandline; +{ + char tmpcommandline[NCCARGS]; + char hostname[MAXHOSTNAMELEN]; + char *webclient_path, *temp; + int cnt; + struct hostent *master_phe_tmp; /* temp. variable added by - Rajesh Shah*/ + + /* + * BUILD THE PORTIONS OF THE cmdline FOR EACH CLIENT THAT WE CAN BUILD NOW. + * WE WILL FILL IN THE NUMBER OF CLIENTS LATER WITH AN sprintf. + */ + D_PRINTF( "Calling gethostname\n" ); + + if(gethostname(hostname,MAXHOSTNAMELEN) != 0) + { + errexit("Could not retrieve local host name"); + } else { + /* convert hostname to address (to avoid DNS problems for webclients) */ + /* The following lines are add to copy the system + buffer (output of gethostbyname()) into user area. + This is because, there are very good chances that later + on system buffer might be overwritten by some calls and + still if your pointer is pointing to same addr. nothing + but only trouble and trouble! Infact this is what + happening when I tried to run webstone benchmark for more + then one clients. It used to over write the webmaster name + with the first client name and so remaining on client(s) + the webclient process(es) were invoked with wrong webmaster + name! This behaviour is observed Solaris 2.4 this bug + can be hit in any OS. - Rajesh Shah 5/18/96 */ + + /* master_phe = gethostbyname(hostname); */ + master_phe_tmp = gethostbyname(hostname); + master_phe = (struct hostent *)malloc(sizeof(struct hostent)); + HostEntCpy(master_phe, master_phe_tmp); + } + + /* set up executable pathname */ +#ifndef WIN32 + temp = getenv("TMPDIR"); + + if ( temp && *temp ) { + webclient_path = (char *)mymalloc( strlen(temp) + strlen("/webclient") + + 1); + strcpy(webclient_path, temp); + strcat(webclient_path, "/webclient"); + + } else +#else + temp = temp; +#endif /* WIN32 */ + webclient_path = PROGPATH; + + + D_PRINTF( "Path to webclient is: %s\n", webclient_path ); + + sprintf(commandline,"%s", webclient_path); + + if(haveproxyserver) + { + sprintf(tmpcommandline, " -P %s", proxyserver); + strcat(commandline, tmpcommandline); + } + if (debug) + { + strcat(commandline," -d"); + } + if (numloops != 0) + { + sprintf(tmpcommandline," -l %d", numloops); + strcat(commandline,tmpcommandline); + } + if (portnum) + { + sprintf(tmpcommandline," -p %d", portnum); + strcat(commandline,tmpcommandline); + } + if (redirect) + { + strcat(commandline," -r"); + } + if (savefile) + { + strcat(commandline," -s"); + } + if (uil_filelist_f) + { + strcat(commandline," -u "); + strcat(commandline,uil_filelist); + } + if (record_all_transactions) + { + strcat(commandline," -R"); + } + if (testtime != 0) + { + sprintf(tmpcommandline," -t %d", testtime); + strcat(commandline,tmpcommandline); + } + + /* + * SET UP A SPACE FOR THE NUMBER OF CLIENTS ON THE commandline. + */ + sprintf(tmpcommandline,"%s -n %%d -w %%s -c %%s:%%d", commandline); + strcpy(commandline,tmpcommandline); + + if (uil_filelist_f == 0) + { + cnt = 0; + while(cnt < number_of_pages) + { + /* + * PUT THE FILES AT THE END OF THE LIST. + */ + strcat(commandline," "); + strcat(commandline,filelist[cnt]); + cnt++; + } + } + puts(commandline); +} + +/* + rexec to the client hosts and start the webclients +*/ +int RexecClients( commandline, clienthostname, serveraddr) +char *commandline; +char clienthostname[MAXCLIENTS][MAXHOSTNAMELEN]; +struct sockaddr_in *serveraddr; + +{ + int tmpfd; + int numclients = 0; + char tmpcommandline[NCCARGS]; + struct servent *inetport; + int cnt; + char buffer[NCCARGS]; + char login[MAXUSERNAME]; + char password[MAXPASSWD]; + FILE *fp; + int returnval; + char *tmphostname; + + memset(buffer, 0, sizeof(buffer)); + + /* + * OPEN UP THE CONFIG FILE. FOR EACH LINE IN THE CONFIG FILE, CHECK + * ITS VALIDITY AND THEN rexec A COMMAND ON THE CLIENT. + */ + + if ((fp = fopen(configfile,"r")) == NULL) + { + errexit("Could not open config file %s\n", configfile); + } + + if ((inetport = getservbyname("exec","tcp")) == NULL) + { + errexit("Could not get service name for exec/tcp\n"); + } + D_PRINTF( "getservbyname returned %d\n", ntohs(inetport->s_port) ); + + cnt = 0; + + D_PRINTF( "rexec loop\n" ); + while(1) + { + char webserver2[MAXHOSTNAMELEN]; + char linebuf[150]; + int num; + char *primename; + + if (NULL == fgets(linebuf, sizeof(linebuf), fp)) + break; + num = sscanf(linebuf,"%s %s %s %d %s",clienthostname[cnt],login,password, + &numclients, webserver2); + if (num < 4) + break; + if (servaddrin_config) { + if (num == 4) { + errexit("No webserver specified in config file for %s\n", clienthostname[cnt]); + } + strcpy(webserver, webserver2); + } + + if (numclients <= 0) + errexit("Number of clients must be >= 0\n"); + if (numclients > MAXPROCSPERNODE) + { + errexit("Number of clients per node can't exceed %d\n", MAXPROCSPERNODE); + } + totalnumclients += numclients; + + primename = pick_webmaster_IP_address(clienthostname[cnt], master_phe, network_mask); + if (primename == NULL) { + errexit("Bad client address %s for Client %d\n", clienthostname[cnt], cnt); + } + + fprintf(stdout,"Client %d: %s \t# Processes: %d\n Webserver: %s\tWebmaster: %s:%d\n", + cnt, clienthostname[cnt], numclients, webserver, primename, + ntohs(serveraddr->sin_port)); + fflush(stdout); + sprintf(tmpcommandline, commandline, numclients, webserver, primename, + ntohs(serveraddr->sin_port)); + + fprintf(stderr, "tmpcommandline: %s\n", tmpcommandline); + + D_PRINTF( "%s rexec %s\n",&clienthostname[cnt],tmpcommandline ); + if (norexec) { + sleep(30); /* gives some time to start clients for debugging */ + } else { + + tmphostname = &(clienthostname[cnt][0]); + tmpfd = rexec(&tmphostname, inetport->s_port, login, password, + tmpcommandline, &sockErr[cnt]); + if((sockIO[cnt] = tmpfd) < 0) + { + errexit("Could not rexec: rexec to client %s, cmdline %s failed\n", + clienthostname[cnt],tmpcommandline); + } + } + + + returnval = NETREAD(tmpfd, buffer, OKSTRLEN); + D_PRINTF( "read returns %d, %s\n", returnval, buffer ); + + if (returnval <= 0 || memcmp(buffer, OKSTR, OKSTRLEN) != 0) + { + errexit("rexec to client %s, cmdline %s received error %s\n", + clienthostname[cnt],tmpcommandline, buffer); + } + + + cnt++; + if (cnt > MAXCLIENTS || cnt > FD_SETSIZE) + { + errexit("Number of Clients can't exceed %d\n", MAXCLIENTS); + } + } + + num_rexecs = cnt; + if (totalnumclients > MAXTOTALPROCS) + { + errexit("Total number of processes can't exceed %d\n", + MAXTOTALPROCS); + } + +#ifndef WIN32 + /* NOW WE NEED TO HANDLE THE OUTPUT FROM THE REXEC. + * TO DO THIS, WE FORK, THEN HAVE ONE PROCESS READ FROM TMPFD. + * THE OTHER PROCESS CONTINUES WITH THE PROGRAM + */ + D_PRINTF( "Forking webclient stderr/stdout processes\n" ); + switch (fork()) + { + case -1: /* ERROR */ + errexit("fork: %s\n", strerror(errno)); + case 0: /* CHILD */ + exit(echo_client(clienthostname[cnt], tmpfd)); + default: /* PARENT */ + break; + } +#else + /* start threads to echo stdout/stderr from clients */ + _beginthread(echo_client, 0, (void *)0); + _beginthread(echo_client, 0, (void *)1); +#endif /* WIN32 */ + + fprintf(stdout,"\n"); + fprintf(stdout,"\n"); + fclose(fp); + + return totalnumclients; +} + +void GetReady( fdset, totalnumclients, sock ) +fd_set *fdset; +int totalnumclients; +int sock; +{ + int cnt,len; + fd_set tmpfdset, leftfdset; + char buffer[NCCARGS]; + + /* + * NOW WE NEED TO ACCEPT ALL THE CONNECTIONS FROM THE CLIENTS, + * ACCEPT ALL THE READY MESSAGES + */ + + D_PRINTF( "Beginning accept loop\n" ); + for (cnt = 0; cnt < totalnumclients; cnt++) + { + D_PRINTF( "Client %d:\t", cnt ); + + { + fd_set readfds; + struct timeval timeout; + int rv; + + timeout.tv_sec = MAX_ACCEPT_SECS; + timeout.tv_usec = 0; + FD_ZERO(&readfds); + FD_SET(sock, &readfds); + + /* if we're hung, quit */ + D_PRINTF("Before select() on listen() socket\n"); + if (!(rv = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout))) { + fprintf(stdout, + "Listen timeout after %d seconds (%d clients so far)\n", + MAX_ACCEPT_SECS, cnt); + D_PRINTF("select() timed out after %d seconds\n", MAX_ACCEPT_SECS); + errexit("Webmaster terminating\n"); + } + } + + if(BADSOCKET(socknum[cnt] = accept(sock, NULL, 0))) + { + /* + * ERROR accepting FROM THE CLIENTS. WE NEED TO ISSUE AN + * ABORT TO ALL. + */ + abort_clients(); + errexit("Error accepting from one of the clients: %s", neterrstr()); + } else + { + /* + * SET THE FD IN THE MASK + */ + FD_SET(socknum[cnt],fdset); + } + D_PRINTF( "on socket %d\n",socknum[cnt] ); + } + D_PRINTF( "\n" ); + + /* + * WAIT FOR A READY. + */ + sleep(1); + fprintf(stdout,"Waiting for READY from %d clients\n",totalnumclients); + fflush(stdout); + leftfdset = *fdset; +#ifndef WIN32 + while(memcmp(&leftfdset,&zerofdset,sizeof(fd_set))) + { + tmpfdset = leftfdset; + + if(select(FD_SETSIZE,&tmpfdset,NULL,NULL,NULL) < 0) + { + /* + * ERROR SELECTING. ABORT ALL. + */ + abort_clients(); + errexit("Error accepting from one of the clients: %s\n", + neterrstr()); + break; + } +#else + /* I don't see why a select is needed at all--all clients must respond + * and there is no synchronization/timing issue. + */ + tmpfdset = leftfdset; + { +#endif /* WIN32 */ + + for (cnt = 0; cnt < totalnumclients; cnt++) + { + /* + * SEE WHICH SOCKETS HAVE A INPUT ON THEM PENDING + * AND RECEIVE IT. + */ + if(!BADSOCKET(socknum[cnt]) && (FD_ISSET(socknum[cnt],&tmpfdset))) + { + /* + * GET THE READY FROM THIS GUY. + * DON'T FORGET TO CLEAR HIS BIT IN THE tmpfdset + */ + len = NETREAD(socknum[cnt],buffer,READYSTRLEN); + if(len != READYSTRLEN) + { + abort_clients(); + errexit("Error reading from client #%d\n", cnt); + } + if(memcmp(buffer, READYSTR, READYSTRLEN)) + { + abort_clients(); + fprintf(stdout,"Received bad READY string: len %d, value %s\n", + len,buffer); + } + FD_CLR(socknum[cnt],&leftfdset); + } + } + } + sleep(1); + fprintf(stdout,"All READYs received\n"); + fflush(stdout); +} + +/* + Start all the clients by sending them a GO signal + totalnumclients is the total number of clients + socknum is an int array with the filedescriptors for all the + client connections +*/ +void SendGo( totalnumclients, socknum) +int totalnumclients; +int *socknum; +{ + int cnt; + fprintf(stdout,"Sending GO to all clients\n"); + for(cnt = 0; cnt < totalnumclients; cnt++) + { + if(socknum[cnt] > 0) + { + /* + * SEND A GO + */ + if(NETWRITE(socknum[cnt], GOSTR, GOSTRLEN) != GOSTRLEN) + { + abort_clients(); + errexit("Error sending GO to client %d: %s\n", cnt, neterrstr()); + } + } + } +} + +/* + This function gathers statistics from all the clients +*/ + +void GetResults(fdset, page_stats, endtime, timestr, totalnumclients, + statarray) +fd_set *fdset; +page_stats_t **page_stats; +time_t *endtime; +char *timestr; +int totalnumclients; +stats_t statarray[MAXCLIENTS]; +{ + fd_set leftfdset,tmpfdset; + char *stats_as_text; + char *page_stats_as_text; + int returnval; + int cnt,i; + + + /* DOESN'T ACTUALLY PRINT UNTIL THE FIRST CLIENT REPORTS */ + fprintf(stdout,"Reading results "); + + /* + * COPY THE FILE DESCRIPTORS TO A TMP LIST, + * ALLOCATE MEMORY FOR STATS, PAGESTATS IN TEXT FORM + */ + leftfdset = *fdset; + stats_as_text = (char *)mymalloc(SIZEOF_STATSTEXT+1); + page_stats_as_text = (char *)mymalloc(SIZEOF_PAGESTATSTEXT+1); + + /* + * COPY THE FILE DESCRIPTORS TO A TMP LIST, + * PLUS A LIST OF REMAINING FDs + */ + leftfdset = *fdset; + /* + * LOOP UNTIL ALL CLIENTS HAVE REPORTED + * AND tmpfdset IS EMPTY + */ +#ifndef WIN32 + while(memcmp(&leftfdset,&zerofdset,sizeof(fd_set))) + { + tmpfdset = leftfdset; + sleep(1); + returnval = select(FD_SETSIZE,&tmpfdset,NULL,NULL,NULL); + D_PRINTF( "Call to select returned %d, errno %d\n", + returnval, errno ); + if(returnval < 0) + { + /* + * ERROR SELECTING. ABORT ALL. + */ + D_PRINTF( "select() error %s\n", neterrstr() ); + abort_clients(); + errexit("Error selecting from one of the clients\n"); + } +#else + /* I don't see why a select is needed at all */ + tmpfdset = leftfdset; + { +#endif /* WIN32 */ + for(cnt = 0; cnt < totalnumclients; cnt++) + { + /* + * SEE WHICH SOCKETS HAVE A INPUT ON THEM PENDING AND + * RECEIVE IT. + */ + + /* IS THIS A VALID SOCKET? IS IT READY TO READ? */ + if(!BADSOCKET(socknum[cnt]) && (FD_ISSET(socknum[cnt],&tmpfdset))) + { + int len; + + /* + * GET THE TIMING DATA FROM THIS GUY + * THEN REMOVE HIM FROM THE tmpfdset + */ + /* + * READ TIME STATS + * DOES READ() RETURN THE CORRECT LENGTH? + */ + D_PRINTF( "About to read timestats, count %d, errno %d\n", + cnt, errno ); + len = SIZEOF_STATSTEXTBASE + number_of_pages*SIZEOF_DOUBLETEXT; + returnval = recvdata(socknum[cnt], stats_as_text, + len); + D_PRINTF( "Read time stats %d\n", returnval ); + if (returnval != len) /* <= 0) */ + { + D_PRINTF( "Error reading timing stats: %s\n", + neterrstr() ); + fprintf(stderr, "Error reading timing stats: %s\nSocket number %d\n", + neterrstr(),socknum[cnt]); + abort_clients(); + errexit(""); + } /* end if */ + + /* convert text to stats */ + stats_as_text[returnval] = 0; /* add an end marker */ + statarray[cnt] = *text_to_stats(stats_as_text); + + fputc('.', stdout); /* PROGRESS MARKER */ + fflush(stdout); + + if(uil_filelist_f) /* READ PAGE STATS */ + { + for (i = 0; i < number_of_pages; i++) + { + D_PRINTF( "On page_stats[%d][%d]\n", cnt, i ); + returnval = recvdata(socknum[cnt], page_stats_as_text, + SIZEOF_PAGESTATSTEXT); + D_PRINTF( "Read page stats %d\n", returnval ); + + if (returnval != SIZEOF_PAGESTATSTEXT) /* <= 0) */ + { + D_PRINTF( "Error reading page_stats[%d][%d]: %s\n", + cnt, i, neterrstr() ); + fprintf(stderr, "Error reading page_stats[%d][%d]: %s\n", + cnt, i, neterrstr()); + abort_clients(); + errexit(""); + } + D_PRINTF( "Page stats: read %d bytes\n", + returnval ); + + page_stats_as_text[returnval] = 0; /* add an end marker */ + D_PRINTF("strlen(page_stats_as_text) = %d\n", + strlen(page_stats_as_text)); + page_stats[cnt][i] = + *text_to_page_stats(page_stats_as_text); + + } /* end for */ + } /* end if filelist */ + + FD_CLR(socknum[cnt],&leftfdset); + NETCLOSE(socknum[cnt]); + socknum[cnt] = BADSOCKET_VALUE; + } /* end if socknum */ + } /* end for cnt */ + } /* end while memcmp fd */ + + /* + * DONE READING RESULTS FROM CLIENTS + */ + + *endtime = time(NULL); + timestr = asctime(localtime(endtime)); + fprintf(stdout,"\nAll clients ended at %s\n",timestr); + fflush(stdout); + + /* FREE MEMORY ALLOCATED FOR CLIENT STATS, PAGESTATS AS TEXT */ + free(stats_as_text); + free(page_stats_as_text); + +} + +/* + Prints out all the results +*/ +void PrintResults( page_stats, endtime, timestr, totalnumclients, statarray, + page_stats_total) +page_stats_t **page_stats; +time_t endtime; +char *timestr; +int totalnumclients; +stats_t statarray[MAXCLIENTS]; +page_stats_t *page_stats_total; +{ + stats_t masterstat; + int cnt,i,j; + double thruput; + struct timeval dtime; + + /* + * PRINT EVERYTHING OUT + */ + stats_init(&masterstat); + for(cnt = 0; cnt < totalnumclients; cnt++) + { + if((statarray[cnt].rs.totalconnects > 0) && (dumpall)) + { + fprintf(stdout,"----------------------------------\n"); + /* fprintf(stdout,"Test for host: %s\n",statarray[cnt].hostname); */ + fprintf(stdout,"Total number of pages retrieved from server: %u\n", + statarray[cnt].totalpages); + + rqstat_fprint(stdout, &(statarray[cnt].rs)); + + thruput = thruputpersec((double)(statarray[cnt].rs.totalbytes), + &(statarray[cnt].rs.totalresponsetime)); + + fprintf(stdout, "Thruput average per connection: %.0f bytes/sec\n", + thruput); + } + if(statarray[cnt].rs.totalconnects > 0) + { + D_PRINTF( "Summing stats for %d, with %ld total connections\n", + cnt, statarray[cnt].rs.totalconnects ); + rqstat_sum(&masterstat.rs, &(statarray[cnt].rs)); + } + else + { + masterstat.rs.totalerrs += statarray[cnt].rs.totalerrs; + } + } + + for (i=0; i < totalnumclients; i++) + { + for (j=0; j < number_of_pages; j++) + { + D_PRINTF( "Summing page stats for %d, page %d, with %d connects\n", + i, j, statarray[i].page_numbers[j] ); + + if (statarray[i].page_numbers[j] != 0) + { + rqst_stats_t *pst_rs; + rqst_stats_t *ps_rs; + + pst_rs = &(page_stats_total[j].rs); + ps_rs = &(page_stats[i][j].rs); + + rqstat_sum(pst_rs, ps_rs); + + page_stats_total[j].totalpages += page_stats[i][j].totalpages; + masterstat.totalpages += page_stats[i][j].totalpages; + + /* yes, this is assignment, not sum */ + page_stats_total[j].page_size = page_stats[i][j].page_size; + + page_stats_total[j].page_valid = 1; + } + } + } + + /* print page statistics */ + if (verbose) { + for (i = 0; i < number_of_pages; i++) + { + if (page_stats_total[i].page_valid == 1) + { + page_stats_t *pst; + + pst = &(page_stats_total[i]); + + printf ("===============================================================================\n"); + printf ("Page # %d\n\n", i); + printf ("Total number of times page was hit %u\n", + pst->totalpages); + + rqstat_print(&(pst->rs)); + + printf ("Page size %u \n", pst->page_size); + printf ("===============================================================================\n\n"); + } + } + } + + fprintf(stdout,"===============================================================================\n"); + + /* + * Validate run. + */ + masterstat.total_num_of_files = statarray[0].total_num_of_files; + for (i=1; i < totalnumclients; i++) + { + if ((statarray[i].rs.totalconnects > 0) && + (statarray[i].total_num_of_files != masterstat.total_num_of_files)) + { + fprintf(stdout,"**********************************************************************\n"); + fprintf(stdout,"**** ERROR: number of files in each test configuration is not the same\n"); + fprintf(stdout,"**** ERROR: Check configuration file %s on each client\n", configfile); + fprintf(stdout,"**********************************************************************\n"); + break; + } + } + + + /* + * Print summary statistics + */ + fprintf(stdout, "WEBSTONE 2.0 results:\n"); + + fprintf(stdout, "Total number of clients: \t%d\n", totalnumclients); + testtime = sumedh_end.tv_sec - sumedh_start.tv_sec; + fprintf(stdout,"Test time: \t\t\t%d seconds\n", testtime); + + fprintf(stdout, "Server connection rate: \t%3.2f connections/sec\n", + (double)(masterstat.rs.totalconnects)/(testtime)); + + fprintf(stdout, "Server error rate: \t\t%4.4f err/sec\n", + (double)(masterstat.rs.totalerrs)/(testtime)); + + fprintf(stdout, "Server thruput: \t\t%2.2f Mbit/sec\n", + (double)(8*masterstat.rs.totalbytes)/(testtime*1024*1024)); + + fprintf(stdout, "Little's Load Factor: \t\t%3.2f \n", + (double)(masterstat.rs.totalresponsetime.tv_sec) + /(testtime)); + avgtime(&masterstat.rs.totalresponsetime, + masterstat.rs.totalconnects, &dtime); + + fprintf(stdout, "Average response time: \t\t%4.4f millisec\n", + (double)1000*(dtime.tv_sec + (double)dtime.tv_usec / 1000000)); + + fprintf(stdout, "Error Level:\t\t\t%4.4f %%\n", + (double)(100 * masterstat.rs.totalerrs)/(masterstat.rs.totalconnects)); + + /* so much for the key metrics */ + + thruput = 8 * thruputpersec((double)(masterstat.rs.totalbytes), + &(masterstat.rs.totalresponsetime)); + + fprintf(stdout, "Average client thruput: \t%4.4f Mbit/sec\n", + thruput/(1024*1024)); + + fprintf(stdout,"Sum of client response times:\t%u.%u sec\n", + masterstat.rs.totalresponsetime.tv_sec, + masterstat.rs.totalresponsetime.tv_usec); + + fprintf(stdout,"Total number of pages read:\t%u\n\n", + masterstat.totalpages); + + /* Remaining stats are the same as usual */ + + rqstat_fprint(stdout, &(masterstat.rs)); + fflush(stdout); + +} + +#ifdef WIN32 +/* close socket library */ +void sock_cleanup(void) { + + WSACleanup(); +} +#endif /* WIN32 */ + +void +main(const int argc, char *argv[]) +{ + + int sync_sock; + int i; + int j; + char buffer[NCCARGS]; + char commandline[NCCARGS]; + char *timestr; + time_t starttime; + time_t endtime; + fd_set fdset; + /* make the big arrays static to avoid stack overflow */ + static char clienthostname[MAXCLIENTS][MAXHOSTNAMELEN]; + static stats_t statarray[MAXCLIENTS]; + page_stats_t **page_stats; + page_stats_t *page_stats_total; + struct sockaddr_in serveraddr; + + +#ifdef WIN32 + WSADATA WSAData; + COORD dwSize; + + if ((WSAStartup(MAKEWORD(1,1), &WSAData)) != 0) { + errexit("Error in WSAStartup()\n"); + } + atexit(sock_cleanup); + + /* increase size of output window */ + dwSize.X = 80; + dwSize.Y = 500; + SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), dwSize); +#endif /* WIN32 */ + + + /* Initalization of variables. */ + debugfile = stdout; + memset(buffer, 0, NCCARGS); + memset(webserver, 0, MAXHOSTNAMELEN); + memset(configfile, 0, MAXPATHLEN); + FD_ZERO(&zerofdset); + FD_ZERO(&fdset); + + for(i = 0; i < MAXCLIENTS; i++) + { + socknum[i] = BADSOCKET_VALUE; + statarray[i].rs.totalconnects = 0; + } + + signal(SIGINT, sig_int); + + ParseCmdLine( argc, argv); + + sync_sock = SetupSyncSocket( &serveraddr ); + + MakeCmdLine( commandline); + + totalnumclients = RexecClients( commandline, clienthostname, &serveraddr); + + /* Initalization of variables. */ + page_stats = + (page_stats_t **) + mymalloc(totalnumclients*sizeof(page_stats_t *)); + for (i=0; i < totalnumclients; i++) + { + page_stats[i] = (page_stats_t *) + mymalloc(number_of_pages*sizeof(page_stats_t)); + } + page_stats_total = + (page_stats_t *)mymalloc(number_of_pages*sizeof(page_stats_t)); + + for (i=0; i < totalnumclients; i++) { + stats_init(&(statarray[i])); + } + for (i=0; i < totalnumclients; i++) { + for (j=0; j < number_of_pages; j++) { + page_stats_init(&(page_stats[i][j])); + } + } + for (i=0; i < number_of_pages; i++) { + page_stats_init(&(page_stats_total[i])); + } + + for(i = 0; i < totalnumclients; i++) + { + socknum[i] = BADSOCKET_VALUE; + statarray[i].rs.totalconnects = 0; + } + + GetReady( &fdset, totalnumclients, sync_sock ); + NETCLOSE(sync_sock); + + /* + * START ALL OF THE CLIENTS BY SENDING THEM A GO SIGNAL. + */ + + + gettimeofday (&sumedh_start, NULL); + SendGo( totalnumclients, socknum); + + /* + * WAIT FOR ALL OF THE CLIENTS TO COMPLETE. WE SHOULD GET A REPLY + * FOR EACH SOCKET WE HAVE OPEN. THE REPLY WILL BE THE TIMING + * INFORMATION WE USE. + */ + + starttime = time(NULL); + timestr = asctime(localtime(&starttime)); + fprintf(stdout,"All clients started at %s\n",timestr); + fprintf(stdout,"Waiting for clients completion\n"); + fflush(stdout); + + /* IF THIS IS A TIMED TEST, WE MIGHT AS WELL SNOOZE */ + if (testtime) { + sleep(testtime * 60); + } + + GetResults( &fdset, page_stats, &endtime, timestr, totalnumclients, + statarray); + + gettimeofday (&sumedh_end, NULL); + PrintResults( page_stats, endtime, timestr, totalnumclients, statarray, + page_stats_total); + + /* free memory */ + for (i = 0; i < totalnumclients; i++) + { + free(page_stats[i]); + } + free(page_stats); + free(page_stats_total); + + exit(0); +} + +/* Added by Rajesh Shah 5/18/96 */ +void +HostEntCpy(struct hostent *dest, struct hostent *src) +{ + + dest->h_name = (char *)malloc(strlen(src->h_name)+1); + strcpy(dest->h_name, src->h_name); + printf("WebMaster name = %s\n", dest->h_name); + dest->h_aliases = src->h_aliases; + dest->h_addrtype = src->h_addrtype; + dest->h_length = src->h_length; + dest->h_addr_list = src->h_addr_list; +} + |