From ee8dde23324da33fb860589680ae3f6147bc24d3 Mon Sep 17 00:00:00 2001 From: tradke Date: Tue, 7 May 2002 07:53:53 +0000 Subject: Include missing header files and prototypes. This closes PR CactusConnect/1023. git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPDExtra/trunk@41 61ea717e-8e0c-4c3c-b38e-e9c67f54f1f1 --- src/Groups.c | 21 +++++-- src/IO.c | 175 ++++++++++++++++++++++++++++------------------------------ src/Startup.c | 48 ++++++++-------- 3 files changed, 126 insertions(+), 118 deletions(-) diff --git a/src/Groups.c b/src/Groups.c index e1c833b..cd4fa5c 100644 --- a/src/Groups.c +++ b/src/Groups.c @@ -3,13 +3,14 @@ @date Wed Sep 14 23:47:43 2000 @author Gabrielle Allen @desc - Pages about groups + Pages about groups. @enddesc @version $Id$ @@*/ #include #include +#include #include "cctk.h" #include "util_String.h" @@ -23,15 +24,16 @@ CCTK_FILEVERSION(CactusConnect_HTTPDExtra_Groups_c) /******************************************************************** - ********************* Local Routine Prototypes ********************* + ********************* External Routines ********************** ********************************************************************/ +int HTTPUTILS_RegisterPages (void); -int HTTPUTILS_RegisterPages(void); -static int MessagesPage(const cGH *cctkGH, httpRequest *request, void *data); /******************************************************************** - ********************* External Routines ********************** + ********************* Internal Routines ********************** ********************************************************************/ +static int MessagesPage(const cGH *cctkGH, httpRequest *request, void *data); + /*@@ @routine HTTPUTILS_RegisterPages @@ -40,6 +42,13 @@ static int MessagesPage(const cGH *cctkGH, httpRequest *request, void *data); @desc Httpd utils registration routine. @enddesc + @calls HTTP_RegisterPage + HTTP_ContentLink + + @returntype int + @returndesc + 0 for success + @endreturndesc @@*/ int HTTPUTILS_RegisterPages (void) { @@ -54,7 +63,7 @@ int HTTPUTILS_RegisterPages (void) } /******************************************************************** - ********************* Local Routines ************************* + ******************** Internal Routines ************************ ********************************************************************/ /*@@ diff --git a/src/IO.c b/src/IO.c index 76319dd..84c4652 100644 --- a/src/IO.c +++ b/src/IO.c @@ -2,16 +2,17 @@ @file IO.c @date Sun Sep 17 16:19:17 2000 @author Tom Goodale - @desc - Stuff for displaying IO callbacks on the web page. - @enddesc - @version $Header$ + @desc + Stuff for displaying IO callbacks on the web page. + @enddesc + @version $Id$ @@*/ #include "cctk.h" #include #include +#include #include #include #include @@ -30,16 +31,24 @@ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusConnect_HTTPDExtra_IO_c) + /******************************************************************** - ********************* Local Data Types *********************** + ******************** Macro Definitions ************************ ********************************************************************/ +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +/******************************************************************** + ********************* Internal Typedefs ********************** + ********************************************************************/ struct httpuFileList { struct httpuFileList *next; char *filename; char *linkname; - ioAdvertisedFileDesc data; + ioAdvertisedFileDesc data; }; struct httpuMimeType @@ -48,37 +57,46 @@ struct httpuMimeType const char *name; }; + /******************************************************************** - ********************* Local Routine Prototypes ********************* + ******************** Internal Routines ************************ ********************************************************************/ - static int IOFileListener(const cGH *GH, const char *filename, const ioAdvertisedFileDesc *description); +static int AdvertisedFilePage(const cGH *GH, httpRequest *request, void *data); +static int ViewportFilePage(const cGH *GH, httpRequest *request, void *data); +static int SendFilePage(const cGH *GH, httpRequest *request, void *data); -static int AdvertisedFilePage(const cGH *cctkGH, httpRequest *request, void *data); -static int ViewportFilePage(const cGH *cctkGH, httpRequest *request, void *data); - -static int SendFilePage(const cGH *cctkGH, httpRequest *request, void *data); /******************************************************************** - ********************* Other Routine Prototypes ********************* + ******************** External Routines ************************ ********************************************************************/ +int HTTP_util_RegisterIOPages(void); + /******************************************************************** ********************* Local Data ***************************** ********************************************************************/ - static struct httpuFileList *filelist = NULL; static struct httpuMimeType *mimetypes = NULL; -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -/******************************************************************** - ********************* External Routines ********************** - ********************************************************************/ + /*@@ + @routine HTTP_util_RegisterIOPages + @date Wed Sep 14 11:29:43 2000 + @author Gabrielle Allen + @desc + Registers HTTPDExtra's Output and ViewPort page. + @enddesc + @calls IOUtil_RegisterAdvertisedFileListener + HTTP_RegisterPage + HTTP_ContentLink + + @returntype int + @returndesc + 0 for success + @endreturndesc +@@*/ int HTTP_util_RegisterIOPages(void) { ioAdvertisedFileListenerCallbacks listener; @@ -102,23 +120,18 @@ int HTTP_util_RegisterIOPages(void) return 0; } + + /******************************************************************** - ********************* Local Routines ************************* + ******************** Internal Routines ************************ ********************************************************************/ - /*@@ @routine IOFileListener @date Sun Sep 17 17:56:22 2000 @author Tom Goodale - @desc - Listener for advertised files. - @enddesc - @calls - @calledby - @history - - @endhistory - + @desc + Listener for advertised files. + @enddesc @@*/ static int IOFileListener(const cGH *GH, const char *filename, const ioAdvertisedFileDesc *description) @@ -129,7 +142,7 @@ static int IOFileListener(const cGH *GH, const char *filename, /* avoid compiler warning about unused parameter */ - GH = GH; + (void) (GH + 0); entry = (struct httpuFileList *)malloc(sizeof(struct httpuFileList)); @@ -168,7 +181,7 @@ static int IOFileListener(const cGH *GH, const char *filename, if(!type) { type = (struct httpuMimeType *)malloc(sizeof(struct httpuMimeType)); - + if(type) { type->name = Util_Strdup(description->mimetype); @@ -176,7 +189,7 @@ static int IOFileListener(const cGH *GH, const char *filename, type->next = mimetypes; mimetypes = type; } - } + } } return 0; @@ -187,17 +200,11 @@ static int IOFileListener(const cGH *GH, const char *filename, @routine AdvertisedFilePage @date Sun Sep 17 18:26:01 2000 @author Tom Goodale - @desc - Page to deal with advertised files. - @enddesc - @calls - @calledby - @history - - @endhistory - + @desc + Page to deal with advertised files. + @enddesc @@*/ -static int AdvertisedFilePage(const cGH *cctkGH, httpRequest *request, void *data) +static int AdvertisedFilePage(const cGH *GH, httpRequest *request, void *data) { int retval; char message[4098]; @@ -209,7 +216,7 @@ static int AdvertisedFilePage(const cGH *cctkGH, httpRequest *request, void *dat /* Status message */ strcpy(message,"HTTP/1.0 200 OK\r\n"); - + HTTP_Write(request, message, strlen(message)); /* Content-Type */ @@ -224,7 +231,7 @@ static int AdvertisedFilePage(const cGH *cctkGH, httpRequest *request, void *dat /* HTTP_Write out the header part. */ - HTTP_ContentHeader(cctkGH, 0, 4098, message,NULL); + HTTP_ContentHeader(GH, 0, 4098, message,NULL); HTTP_Write(request, message, strlen(message)); @@ -252,22 +259,22 @@ static int AdvertisedFilePage(const cGH *cctkGH, httpRequest *request, void *dat for (list = filelist; list; list = list->next) { - sprintf(message, + sprintf(message, "%s" "%s%s\n", - list->linkname, list->filename, + list->linkname, list->filename, list->data.varname, list->data.description); HTTP_Write(request, message, strlen(message)); } strcpy(message,""); HTTP_Write(request, message, strlen(message)); - + /* Write out the footer part. */ /* HTTP_Write out the footer part. */ - HTTP_ContentFooter(cctkGH, 0, 4098, message); + HTTP_ContentFooter(GH, 0, 4098, message); retval = HTTP_Write(request, message, strlen(message)); @@ -279,17 +286,11 @@ static int AdvertisedFilePage(const cGH *cctkGH, httpRequest *request, void *dat @routine SendFilePage @date Sun Sep 17 18:43:40 2000 @author Tom Goodale - @desc - Sends an advertised file. - @enddesc - @calls - @calledby - @history - - @endhistory - + @desc + Sends an advertised file. + @enddesc @@*/ -static int SendFilePage(const cGH *cctkGH, httpRequest *request, void *data) +static int SendFilePage(const cGH *GH, httpRequest *request, void *data) { char message[4098]; struct httpuFileList *list; @@ -297,7 +298,7 @@ static int SendFilePage(const cGH *cctkGH, httpRequest *request, void *data) /* avoid compiler warning about unused parameters */ - cctkGH = cctkGH; + (void) (GH + 0); data = data; for (list = filelist; list; list = list->next) @@ -305,14 +306,14 @@ static int SendFilePage(const cGH *cctkGH, httpRequest *request, void *data) if(!strcmp(list->linkname, request->residual)) { if((filedes = open(list->filename, O_RDONLY | O_BINARY)) >= 0) - { + { strcpy(message,"HTTP/1.0 200 OK\r\n"); - + HTTP_Write(request, message, strlen(message)); - + /* Content-Type */ sprintf(message,"Content-Type: %s\r\n\r\n", list->data.mimetype); - + HTTP_Write(request, message, strlen(message)); HTTP_ContentSendFromFile(request, filedes); @@ -323,10 +324,10 @@ static int SendFilePage(const cGH *cctkGH, httpRequest *request, void *data) { strcpy(message,"HTTP/1.0 500 Server Internal Error\r\n"); HTTP_Write(request, message, strlen(message)); - + /* Content-Type */ strcpy(message,"Content-Type: text/html\r\n\r\n"); - + HTTP_Write(request, message, strlen(message)); sprintf(message, @@ -343,38 +344,32 @@ static int SendFilePage(const cGH *cctkGH, httpRequest *request, void *data) { strcpy(message,"HTTP/1.0 404 Not Found\r\n"); HTTP_Write(request, message, strlen(message)); - + /* Content-Type */ strcpy(message,"Content-Type: text/html\r\n\r\n"); - + HTTP_Write(request, message, strlen(message)); - + sprintf(message, "\nError 404: Not Found\n" "

%s does not exist

\n\n", request->uri); HTTP_Write(request, message, strlen(message)); - } + } return 0; } - + /*@@ @routine AdvertisedFilePage @date Sun Sep 17 18:26:01 2000 @author Tom Goodale - @desc - Page to deal with advertised files. - @enddesc - @calls - @calledby - @history - - @endhistory - + @desc + Page to deal with advertised files. + @enddesc @@*/ -static int ViewportFilePage(const cGH *cctkGH, httpRequest *request, void *data) +static int ViewportFilePage(const cGH *GH, httpRequest *request, void *data) { int retval; int foundone; @@ -383,12 +378,12 @@ static int ViewportFilePage(const cGH *cctkGH, httpRequest *request, void *data) /* avoid compiler warning about unused parameters */ - cctkGH = cctkGH; + (void) (GH + 0); data = data; /* Status message */ strcpy(message,"HTTP/1.0 200 OK\r\n"); - + HTTP_Write(request, message, strlen(message)); /* Content-Type */ @@ -403,7 +398,7 @@ static int ViewportFilePage(const cGH *cctkGH, httpRequest *request, void *data) /* HTTP_Write out the header part. */ - HTTP_ContentHeader(cctkGH, 0, 4098, message,NULL); + HTTP_ContentHeader(GH, 0, 4098, message,NULL); HTTP_Write(request, message, strlen(message)); @@ -437,7 +432,7 @@ static int ViewportFilePage(const cGH *cctkGH, httpRequest *request, void *data) HTTP_Write(request, message, strlen(message)); foundone = 1; } - sprintf(message, + sprintf(message, "\n" "%s
\n" "%s\n" @@ -445,7 +440,7 @@ static int ViewportFilePage(const cGH *cctkGH, httpRequest *request, void *data) "%s\n" "\n" "\n", - list->data.varname,list->linkname, list->filename, + list->data.varname,list->linkname, list->filename, list->data.description,list->linkname,list->linkname); HTTP_Write(request, message, strlen(message)); } @@ -461,10 +456,10 @@ static int ViewportFilePage(const cGH *cctkGH, httpRequest *request, void *data) strcpy(message,"\n
\n"); HTTP_Write(request, message, strlen(message)); - + /* Write out the footer part. */ - HTTP_ContentFooter(cctkGH, 0, 4098, message); + HTTP_ContentFooter(GH, 0, 4098, message); retval = HTTP_Write(request, message, strlen(message)); diff --git a/src/Startup.c b/src/Startup.c index cced047..8f5b2e5 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -2,45 +2,50 @@ @file Startup.c @date Wed Sep 13 21:26:56 2000 @author Tom Goodale - @desc - - @enddesc - @version $Header$ + @desc + Thorn HTTPDExtra's startup routines. + @enddesc + @version $Id$ @@*/ -#include -#include - #include "cctk.h" - -#include "cctk_Arguments.h" -#include "cctk_Parameters.h" - #include "httpextra_HostNames.h" static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusConnect_HTTPDExtra_Startup_c) + +/******************************************************************** + ******************** External Routines ************************ + ********************************************************************/ int HTTPUTILS_Startup(void); + /*@@ @routine HTTP_Startup @date Wed Sep 13 21:26:56 2000 @author Tom Goodale - @desc - Startup routine for the webserver. - @enddesc - @calls - @calledby - @history - - @endhistory - + @desc + Startup routine for the webserver. + @enddesc + @calls HTTPDExtra_CollateHostData + HTTPUTILS_RegisterPages + HTTP_util_RegisterIOPages + HTTPDExtra_RegisterProcessorsPages + + @returntype int + @returndesc + 0 for success + @endreturndesc @@*/ int HTTPUTILS_Startup(void) { - DECLARE_CCTK_PARAMETERS + /* FIXME: should put this prototype into a header file */ + extern int HTTPUTILS_RegisterPages(void); + extern int HTTP_util_RegisterIOPages(void); + extern int HTTPDExtra_RegisterProcessorsPages(void); + HTTPDExtra_CollateHostData(); @@ -52,4 +57,3 @@ int HTTPUTILS_Startup(void) return 0; } - -- cgit v1.2.3