aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--README.md59
-rw-r--r--export/include/world_api.h19
-rw-r--r--src/server_reqs.c18
-rw-r--r--src/userdb.c18
5 files changed, 117 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 9b0fbaa..fe2b015 100644
--- a/Makefile
+++ b/Makefile
@@ -5,10 +5,11 @@ PLATFORM = unix
NETCOSM_SRC = $(shell cat SOURCES)
NETCOSM_OBJ := $(NETCOSM_SRC:.c=.o)
-CFLAGS = -O3 -g -I src/ -I export/include -Wall -Wextra -Wshadow -std=gnu99 -fno-strict-aliasing
+CFLAGS = -O3 -g -I src/ -I export/include -Wall -Wextra -Wshadow \
+ -std=gnu99 -fno-strict-aliasing
LDFLAGS = -lgcrypt -lev
-HEADERS = src/hash.h src/telnet.h src/userdb.h
+HEADERS = src/*.h export/include/*.h
all: $(OUT)/$(PLATFORM).bin Makefile $(HEADERS)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8640d02
--- /dev/null
+++ b/README.md
@@ -0,0 +1,59 @@
+NetCosm
+=======
+
+NetCosm is currently under development. Things /WILL/ break, and
+features might drift out of existence without prior warning!
+
+## Installation
+
+### Prerequisities:
+
+libgcrypt
+libev
+linux >= 2.6.27
+glibc >= 2.9
+
+### Compiling
+
+ make
+
+This gives you the executable in `build/unix.bin`.
+
+## Todo List
+
+World persistence (partial)
+Inventory
+Verbs
+Game scripting
+NPCs
+
+## Internal Design
+
+A child process is spawned for every client that connects. There are
+two pipes created for every child: a pipe for the child to write to,
+and a pipe for the master to write to.
+
+### Child-Master Requests
+
+Many operations, such as listing clients, require the help of the
+master process. To request an operation, the child writes it's request
+data to it's pipe to the parent. The size of the request MUST be less
+than PIPE_BUF, which is 4096 on Linux. The format of the request is as
+follows:
+
+ | Child PID | Request Length | Request Code | Data (if any) |
+
+The master polls child pipes for data, and processes any requests it
+finds. The master then writes it's data to the pipes of any children
+involved in the request, signals them with SIGRTMIN+0, and waits for
+all of them to signal back with SIGRTMIN+1. The children read the data
+from the master, and handle it accordingly.
+
+TODO: the signal-based ACK framework is really flakey. A better idea
+would be to have the child poll for data from the master at intervals,
+so the whole mess of signal handling can be avoided.
+
+## Design Goals
+
+Handle 100 simultaneous users sending 100 requests/second with 50ms
+latency.
diff --git a/export/include/world_api.h b/export/include/world_api.h
index 93d04a6..62cc74a 100644
--- a/export/include/world_api.h
+++ b/export/include/world_api.h
@@ -1,2 +1,21 @@
+/*
+ * NetCosm - a MUD server
+ * Copyright (C) 2016 Franklin Wei
+ *
+ * This program 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
#include "globals.h"
+
#include "room.h"
diff --git a/src/server_reqs.c b/src/server_reqs.c
index fd92b00..1270246 100644
--- a/src/server_reqs.c
+++ b/src/server_reqs.c
@@ -1,3 +1,21 @@
+/*
+ * NetCosm - a MUD server
+ * Copyright (C) 2016 Franklin Wei
+ *
+ * This program 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
#include "globals.h"
#include "hash.h"
diff --git a/src/userdb.c b/src/userdb.c
index a98a33e..569ad92 100644
--- a/src/userdb.c
+++ b/src/userdb.c
@@ -1,3 +1,21 @@
+/*
+ * NetCosm - a MUD server
+ * Copyright (C) 2016 Franklin Wei
+ *
+ * This program 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
#include "globals.h"
#include "client.h"