From 33cafa7659f9652f8574297da64fdddfa343864f Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 4 Jan 1999 03:45:24 +0000 Subject: [PATCH] Added networking configuration screens. These still need testing. --- webcit/ChangeLog | 1 + webcit/Makefile.in | 7 +- webcit/child.h | 10 ++ webcit/netconf.c | 366 +++++++++++++++++++++++++++++++++++++++++++++ webcit/webcit.c | 40 +++++ 5 files changed, 422 insertions(+), 2 deletions(-) create mode 100644 webcit/netconf.c diff --git a/webcit/ChangeLog b/webcit/ChangeLog index c7b2af093..fff72b04d 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -5,6 +5,7 @@ Sun Jan 3 20:05:31 EST 1999 Art Cancro * Established that a one-to-one WebCit/Citadel correspondence will be required. No big deal due to shared code segments. * Added "change password" + * Added networking configuration screens. These still need testing. Thu Dec 31 21:53:20 EST 1998 Art Cancro * Final cvs commit for 1998 (an awful year, I'm glad to see it over). diff --git a/webcit/Makefile.in b/webcit/Makefile.in index 9a9008c9a..bbe64c88a 100644 --- a/webcit/Makefile.in +++ b/webcit/Makefile.in @@ -36,10 +36,10 @@ snprintf.o: snprintf.c webcit: webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \ roomops.o tools.o messages.o userlist.o paging.o sysmsgs.o \ - mime_parser.o graphics.o + mime_parser.o graphics.o netconf.o $(CC) webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \ tools.o roomops.o messages.o userlist.o paging.o sysmsgs.o \ - mime_parser.o graphics.o -o webcit + mime_parser.o graphics.o netconf.o -o webcit webcit.o: webcit.c webcit.h child.h $(CC) $(CFLAGS) $(DEFS) -c webcit.c @@ -83,6 +83,9 @@ sysmsgs.o: sysmsgs.c webcit.h child.h mime_parser.o: mime_parser.c webcit.h child.h $(CC) $(CFLAGS) $(DEFS) -c mime_parser.c +netconf.o: netconf.c webcit.h child.h + $(CC) $(CFLAGS) $(DEFS) -c netconf.c + Makefile: $(srcdir)/Makefile.in config.status CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status diff --git a/webcit/child.h b/webcit/child.h index aa5810346..9236f7273 100644 --- a/webcit/child.h +++ b/webcit/child.h @@ -86,3 +86,13 @@ void display_reg(int); void register_user(void); void display_changepw(void); void changepw(void); +void display_edit_node(void); +void display_netconf(void); +void display_confirm_unshare(void); +void display_confirm_delete_node(void); +void delete_node(void); +void unshare(void); +void display_add_node(void); +void add_node(void); +void display_share(void); +void share(void); diff --git a/webcit/netconf.c b/webcit/netconf.c new file mode 100644 index 000000000..6fc58dbab --- /dev/null +++ b/webcit/netconf.c @@ -0,0 +1,366 @@ +#include +#include +#include +#include +#include +#include +#include +#include "webcit.h" +#include "child.h" + +struct sharelist { + struct sharelist *next; + char shname[256]; + }; + + +void display_edit_node(void) { + char buf[256]; + char node[256]; + char sroom[256]; + + strcpy(node, bstr("node")); + + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + wprintf("
"); + wprintf("Edit share list for "); + escputs(node); + wprintf("\n"); + wprintf("
\n"); + + wprintf("
\n"); + wprintf("Add a shared room
\n"); + + wprintf("Return to network configuration screen
\n"); + + serv_printf("NSET roomlist|%s", node); + serv_gets(buf); + if (buf[0] == '1') { + wprintf("\n"); + while (serv_gets(buf), strcmp(buf, "000")) { + extract(sroom, buf, 0); + wprintf(""); + wprintf(""); + wprintf("\n"); + } + wprintf("
"); + escputs(sroom); + wprintf("(UnShare)
\n"); + } + + wprintf("
\n"); + wDumpContent(); + } + + + +void display_netconf(void) { + char buf[256]; + char node[256]; + + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + wprintf("
"); + wprintf("Network configuration\n"); + wprintf("
\n"); + + wprintf("
"); + wprintf(""); + wprintf("Add a new node
\n"); + wprintf("
"); + + wprintf("
"); + wprintf("Currently configured nodes\n"); + wprintf("
\n"); + serv_puts("NSET nodelist"); + serv_gets(buf); + if (buf[0] == '1') { + wprintf("
\n"); + while (serv_gets(buf), strcmp(buf, "000")) { + extract(node, buf, 0); + wprintf(""); + wprintf(""); + wprintf(""); + wprintf("\n"); + } + wprintf("
"); + escputs(node); + wprintf("(Edit)(Delete)
\n"); + } + + wprintf("
\n"); + wDumpContent(); + } + + +void display_confirm_unshare(void) { + char node[256]; + char sroom[256]; + + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + wprintf("
"); + wprintf("Confirm unshare\n"); + wprintf("
\n"); + + strcpy(node, bstr("node")); + strcpy(sroom, bstr("sroom")); + wprintf("
Are you sure you want to unshare "); + escputs(sroom); + wprintf("?
\n"); + wprintf("Yes   "); + wprintf("No
\n"); + wDumpContent(); + } + + +void display_confirm_delete_node(void) { + char node[256]; + + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + wprintf("
"); + wprintf("Confirm delete\n"); + wprintf("
\n"); + + strcpy(node, bstr("node")); + wprintf("
Are you sure you want to delete "); + escputs(node); + wprintf("?
\n"); + wprintf("Yes   "); + wprintf("No
\n"); + wprintf("\n"); + wDumpContent(); + } + + +void delete_node(void) { + char node[256]; + char buf[256]; + + strcpy(node, bstr("node")); + sprintf(buf, "NSET deletenode|%s", node); + serv_puts(buf); + serv_gets(buf); + if (buf[0]=='1') { + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + server_to_text(); + wprintf("Back to menu\n"); + wprintf("\n"); + wDumpContent(); + } + else { + display_error(&buf[4]); + } + } + + +void unshare(void) { + char node[256]; + char sroom[256]; + char buf[256]; + + strcpy(node, bstr("node")); + strcpy(sroom, bstr("sroom")); + sprintf(buf, "NSET unshare|%s|%s", node, sroom); + serv_puts(buf); + serv_gets(buf); + if (buf[0]=='1') { + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + server_to_text(); + wprintf("Back to menu\n"); + wprintf("\n"); + wDumpContent(); + } + else { + display_error(&buf[4]); + } + } + + + +void display_add_node(void) { + + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + wprintf("
"); + wprintf("Add a new node\n"); + wprintf("
\n"); + + wprintf("
"); + wprintf("
\n"); + + wprintf("Enter name of new node: "); + wprintf("
\n"); + + wprintf(""); + wprintf(""); + + wprintf("
\n"); + wDumpContent(); + } + + + +void add_node(void) { + char node[256]; + char buf[256]; + char sc[256]; + + strcpy(node, bstr("node")); + strcpy(sc, bstr("sc")); + + if (!strcmp(sc, "Add")) { + sprintf(buf, "NSET addnode|%s", node); + serv_puts(buf); + serv_gets(buf); + if (buf[0]=='1') { + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + server_to_text(); + wprintf("Back to menu\n"); + wprintf("\n"); + wDumpContent(); + } + else { + display_error(&buf[4]); + } + } + + } + + + +void display_share(void) { + char buf[256]; + char node[256]; + char sroom[256]; + struct sharelist *shlist = NULL; + struct sharelist *shptr; + int already_shared; + + strcpy(node, bstr("node")); + + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + wprintf("
"); + wprintf("Add a shared room\n"); + wprintf("
\n"); + + wprintf("
"); + wprintf("
\n"); + wprintf("\n"); + + sprintf(buf, "NSET roomlist|%s", node); + serv_puts(buf); + serv_gets(buf); + if (buf[0]=='1') { + while(serv_gets(buf), strcmp(buf,"000")) { + shptr = (struct sharelist *) + malloc(sizeof(struct sharelist)); + shptr -> next = shlist; + extract(shptr->shname, buf, 0); + shlist = shptr; + } + } + + wprintf("\n"); + wprintf("
\n"); + + wprintf(""); + wprintf(""); + + wprintf("
\n"); + wDumpContent(); + + /* free the list */ + while (shlist != NULL) { + shptr = shlist->next; + free(shlist); + shlist = shptr; + } + + } + + + +void share(void) { + char node[256]; + char buf[256]; + char sc[256]; + char sroom[256]; + + strcpy(node, bstr("node")); + strcpy(sc, bstr("sc")); + strcpy(sroom, bstr("sroom")); + + if (!strcmp(sc, "Share")) { + sprintf(buf, "NSET share|%s|%s", node, sroom); + serv_puts(buf); + serv_gets(buf); + if (buf[0]=='1') { + printf("HTTP/1.0 200 OK\n"); + output_headers(1); + server_to_text(); + wprintf("Back to menu\n"); + wprintf("\n"); + wDumpContent(); + } + else { + display_error(&buf[4]); + } + + } + } + diff --git a/webcit/webcit.c b/webcit/webcit.c index 551b13c36..2f6798de2 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -828,6 +828,46 @@ void session_loop(void) { changepw(); } + else if (!strcasecmp(action, "display_edit_node")) { + display_edit_node(); + } + + else if (!strcasecmp(action, "display_netconf")) { + display_netconf(); + } + + else if (!strcasecmp(action, "display_confirm_unshare")) { + display_confirm_unshare(); + } + + else if (!strcasecmp(action, "display_confirm_delete_node")) { + display_confirm_delete_node(); + } + + else if (!strcasecmp(action, "delete_node")) { + delete_node(); + } + + else if (!strcasecmp(action, "unshare")) { + unshare(); + } + + else if (!strcasecmp(action, "display_add_node")) { + display_add_node(); + } + + else if (!strcasecmp(action, "add_node")) { + add_node(); + } + + else if (!strcasecmp(action, "display_share")) { + display_share(); + } + + else if (!strcasecmp(action, "share")) { + share(); + } + /* When all else fails... */ else { printf("HTTP/1.0 200 OK\n"); -- 2.39.2