aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorallen <allen@61ea717e-8e0c-4c3c-b38e-e9c67f54f1f1>2000-11-08 15:20:10 +0000
committerallen <allen@61ea717e-8e0c-4c3c-b38e-e9c67f54f1f1>2000-11-08 15:20:10 +0000
commitbfd3be47405652e9cc0f314af65b54f4fcd3cb6a (patch)
tree07b0ca0409a7f873004ea1df8fccc27fba9d3835 /src
parent0f338a570c159935fc3684aa980318b8b859097d (diff)
Adding page for processor information, not fully tested ...
git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPDExtra/trunk@19 61ea717e-8e0c-4c3c-b38e-e9c67f54f1f1
Diffstat (limited to 'src')
-rw-r--r--src/Processors.c156
-rw-r--r--src/Startup.c6
-rw-r--r--src/make.code.defn2
3 files changed, 163 insertions, 1 deletions
diff --git a/src/Processors.c b/src/Processors.c
new file mode 100644
index 0000000..c7f2947
--- /dev/null
+++ b/src/Processors.c
@@ -0,0 +1,156 @@
+ /*@@
+ @file Processors.c
+ @date Wed Nov 8 2000
+ @author Gabrielle Allen
+ @desc
+ Pages about processors
+ @enddesc
+ @version $Header$
+ @@*/
+
+#include <stdio.h>
+
+#include "cctk.h"
+
+#include "util_String.h"
+
+#include "CactusConnect/HTTPD/src/http_Request.h"
+#include "CactusConnect/HTTPD/src/http_Content.h"
+#include "httpextra_HostNames.h"
+
+static char *rcsid = "$Header$";
+
+CCTK_FILEVERSION(CactusConnect_HTTPDExtra_Processors_c)
+
+/********************************************************************
+ ********************* Local Data Types ***********************
+ ********************************************************************/
+
+/********************************************************************
+ ********************* Local Routine Prototypes *********************
+ ********************************************************************/
+
+static int ProcessorsPage(cGH *cctkGH, httpRequest *request, void *data);
+
+
+/********************************************************************
+ ********************* Other Routine Prototypes *********************
+ ********************************************************************/
+
+/********************************************************************
+ ********************* Local Data *****************************
+ ********************************************************************/
+
+/********************************************************************
+ ********************* External Routines **********************
+ ********************************************************************/
+
+ /*@@
+ @routine HTTPDExtra_RegisterProcessorsPages
+ @date Wed Sep 14 11:29:43 2000
+ @author Gabrielle Allen
+ @desc
+ Httpd utils registration routine.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+int HTTPDExtra_RegisterProcessorsPages(void)
+{
+ /* Register the group info page. */
+ HTTP_RegisterPage("/Processors", ProcessorsPage, NULL);
+
+ HTTP_ContentLink("/Processors/index.html", "Processor Information",
+ "Processor layout and properties",
+ HTTP_QUICKLINK);
+ return 0;
+}
+
+/********************************************************************
+ ********************* Local Routines *************************
+ ********************************************************************/
+
+
+/******************************************************************************
+ ***************************** Groups Page **************************************
+ ******************************************************************************/
+
+ /*@@
+ @routine ProcessorsPage
+ @date Thu Sep 14 23:47:43 2000
+ @author Gabrielle Allen
+ @desc
+ Displays the processor description page.
+ @enddesc
+ @calls
+ @calledby
+@@*/
+static int ProcessorsPage(cGH *cctkGH, httpRequest *request, void *data)
+{
+ int retval;
+ int nprocs,np;
+ char message[4098];
+
+ /* Status message */
+ strcpy(message,"HTTP/1.0 200 OK\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));
+
+
+ /* Start the page */
+ strcpy(message,"<HTML><HEAD><TITLE>Cactus Simulation Processor Information</TITLE>\n");
+
+ HTTP_Write(request, message, strlen(message));
+
+ /* HTTP_Write out the header part. */
+
+ HTTP_ContentHeader(cctkGH,0,strlen(message),message,NULL);
+
+ retval = HTTP_Write(request, message, strlen(message));
+
+ strcpy(message, "<center><h1>Processor Information</h1></center>\n");
+ retval = HTTP_Write(request, message, strlen(message));
+
+ strcpy(message,
+ "<center>\n<table>\n"
+ "<tr>"
+ "<th>Number</th>\n"
+ "<th>Machine Name</th>\n"
+ "<\tr>");
+ retval = HTTP_Write(request, message, strlen(message));
+
+ nprocs = CCTK_nProcs(cctkGH);
+ for (np=0;np<nprocs;np++)
+ {
+ sprintf(message,
+ "<tr>"
+ "<td align=center>%d</td>"
+ "<td align=left>%s</td>"
+ "</tr>\n",
+ np,
+ HTTPDExtra_RemoteHostName(np)
+ );
+ retval = HTTP_Write(request, message, strlen(message));
+ }
+
+ strcpy(message,
+ "</table>\n</center>\n");
+ retval = HTTP_Write(request, message, strlen(message));
+
+ /* Write out the footer part. */
+
+ HTTP_ContentFooter(cctkGH,0,strlen(message),message);
+ retval = HTTP_Write(request, message, strlen(message));
+
+ return retval;
+}
+
diff --git a/src/Startup.c b/src/Startup.c
index c07145b..918e52f 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -16,6 +16,8 @@
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
+#include "httpextra_HostNames.h"
+
static char *rcsid = "$Header$";
CCTK_FILEVERSION(DevThorn_http_utils_Startup_c)
@@ -38,10 +40,14 @@ int HTTPUTILS_Startup(void)
{
DECLARE_CCTK_PARAMETERS
+ HTTPDExtra_CollateHostData();
+
HTTPUTILS_RegisterPages();
HTTP_util_RegisterIOPages();
+ HTTPDExtra_RegisterProcessorsPages();
+
return 0;
}
diff --git a/src/make.code.defn b/src/make.code.defn
index 32cee1f..83438d1 100644
--- a/src/make.code.defn
+++ b/src/make.code.defn
@@ -2,7 +2,7 @@
# $Header$
# Source files in this directory
-SRCS = Groups.c Startup.c IO.c HostNames.c
+SRCS = Groups.c Startup.c IO.c Processors.c HostNames.c
# Subdirectories containing source files
SUBDIRS =