summary refs log tree commit diff
path: root/bounce.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bounce.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/bounce.h b/bounce.h
index e81ed8f..491616b 100644
--- a/bounce.h
+++ b/bounce.h
@@ -16,6 +16,7 @@
 
 #include <stdbool.h>
 #include <stdlib.h>
+#include <string.h>
 #include <tls.h>
 
 #ifndef DEFAULT_CERT_PATH
@@ -30,6 +31,29 @@ struct Client {
 	struct tls *tls;
 };
 
+#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
+
+enum { ParamCap = 15 };
+struct Command {
+	const char *origin;
+	const char *name;
+	const char *params[ParamCap];
+};
+
+static inline struct Command parse(char *line) {
+	struct Command cmd = {0};
+	if (line[0] == ':') cmd.origin = 1 + strsep(&line, " ");
+	cmd.name = strsep(&line, " ");
+	for (size_t i = 0; line && i < ParamCap; ++i) {
+		if (line[0] == ':') {
+			cmd.params[i] = &line[1];
+			break;
+		}
+		cmd.params[i] = strsep(&line, " ");
+	}
+	return cmd;
+}
+
 bool verbose;
 
 void listenConfig(const char *cert, const char *priv);
'nohover-highlight'> 2021-05-25build: Add scripts to EXTRA_DISTJune McEnroe 2021-05-25import: Add missing scripts/wrap-compiler-for-flag-checkJune McEnroe 2021-05-08Import LibreSSL 3.3.3June McEnroe 2021-04-18build: Remove added x509_verify.3 links 3.3.2June McEnroe 2021-04-18tls: Use EC_KEY_set_ex_dataJune McEnroe 2021-04-18Import LibreSSL 3.3.2June McEnroe 2021-03-05Bump version to 3.3.1p1 3.3.1p1June McEnroe 2021-03-05build: Add OpenSSL includes to libcompatJune McEnroe Some compat sources (getentropy_linux.c for example) require OpenSSL. Reported by Robert Scheck. 2020-12-15Import LibreSSL 3.3.1June McEnroe 2020-11-24Import LibreSSL 3.3.0June McEnroe 2020-10-22Import LibreSSL 3.2.2June McEnroe 2020-09-29Import LibreSSL 3.2.1June McEnroe 2020-09-29import: Add m4/ax_add_fortify_source.m4June McEnroe 2020-08-05build: Add README.7 to EXTRA_DIST 3.2.0June McEnroe 2020-08-03doc: Indicate that only OpenSSL 1.1.1b and newer workJune McEnroe