summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-11-10 15:09:32 -0500
committerJune McEnroe <june@causal.agency>2019-11-10 15:09:32 -0500
commit510e4e18d1ce46d8a1ae2ed5eff54304598c1529 (patch)
treec09dcf116541e85fdcb7f245c72ac59b5fb822eb
parentRemove extended-join and invite-notify (diff)
downloadpounce-510e4e18d1ce46d8a1ae2ed5eff54304598c1529.tar.gz
pounce-510e4e18d1ce46d8a1ae2ed5eff54304598c1529.zip
Rename listen to local
Diffstat (limited to '')
-rw-r--r--Makefile2
-rw-r--r--README.716
-rw-r--r--bounce.c10
-rw-r--r--bounce.h8
-rw-r--r--local.c (renamed from listen.c)8
5 files changed, 22 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index 4c7b47d..73d25c6 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ DIRS = ${ETCDIR}/pounce /var/run/calico
 OBJS += bounce.o
 OBJS += client.o
 OBJS += config.o
-OBJS += listen.o
+OBJS += local.o
 OBJS += ring.o
 OBJS += server.o
 OBJS += state.o
diff --git a/README.7 b/README.7
index ac3023e..369f78f 100644
--- a/README.7
+++ b/README.7
@@ -1,4 +1,4 @@
-.Dd November 6, 2019
+.Dd November 10, 2019
 .Dt README 7
 .Os "Causal Agency"
 .
@@ -52,15 +52,15 @@ rather than being limited to messages.
 .Sh FILES
 .Bl -tag -width "dispatch.c" -compact
 .It Pa bounce.h
-common declarations and general functions
+declarations and common functions
 .It Pa bounce.c
-command line parsing and event loop
-.It Pa listen.c
-local server functions
+configuration and event loop
+.It Pa local.c
+local server binding
 .It Pa server.c
-remote server functions
+remote server connection
 .It Pa client.c
-remote client functions
+remote client connections
 .It Pa state.c
 state shared between clients
 .It Pa ring.c
@@ -69,7 +69,7 @@ buffer between server and clients
 .Xr getopt_long 3 Ns -integrated
 configuration parsing
 .It Pa dispatch.c
-SNI socket dispatcher
+SNI socket dispatch
 .It Pa compat.h
 compatibility with lesser operating systems
 .It Pa rc.d/
diff --git a/bounce.c b/bounce.c
index bc97cf3..1587d81 100644
--- a/bounce.c
+++ b/bounce.c
@@ -333,14 +333,14 @@ int main(int argc, char *argv[]) {
 	struct SplitPath privSplit = splitPath(privPath);
 	FILE *cert = splitOpen(certSplit);
 	FILE *priv = splitOpen(privSplit);
-	listenConfig(cert, priv);
+	localConfig(cert, priv);
 	fclose(cert);
 	fclose(priv);
 
 	int bind[8];
 	size_t binds = bindPath[0]
-		? listenUnix(bind, ARRAY_LEN(bind), bindPath)
-		: listenBind(bind, ARRAY_LEN(bind), bindHost, bindPort);
+		? localUnix(bind, ARRAY_LEN(bind), bindPath)
+		: localBind(bind, ARRAY_LEN(bind), bindHost, bindPort);
 
 	serverConfig(insecure, clientCert, clientPriv);
 	int server = serverConnect(host, port);
@@ -399,7 +399,7 @@ int main(int argc, char *argv[]) {
 		if (signals[SIGUSR1]) {
 			cert = splitOpen(certSplit);
 			priv = splitOpen(privSplit);
-			listenConfig(cert, priv);
+			localConfig(cert, priv);
 			fclose(cert);
 			fclose(priv);
 			signals[SIGUSR1] = 0;
@@ -417,7 +417,7 @@ int main(int argc, char *argv[]) {
 
 			if (!event.clients[i]) {
 				int fd;
-				struct tls *tls = listenAccept(&fd, event.fds[i].fd);
+				struct tls *tls = localAccept(&fd, event.fds[i].fd);
 				int error = tls_handshake(tls);
 				if (error) {
 					warnx("tls_handshake: %s", tls_error(tls));
diff --git a/bounce.h b/bounce.h
index 518360e..e304055 100644
--- a/bounce.h
+++ b/bounce.h
@@ -118,10 +118,10 @@ void ringInfo(void);
 int ringSave(FILE *file);
 void ringLoad(FILE *file);
 
-void listenConfig(FILE *cert, FILE *priv);
-size_t listenBind(int fds[], size_t cap, const char *host, const char *port);
-size_t listenUnix(int fds[], size_t cap, const char *path);
-struct tls *listenAccept(int *fd, int bind);
+void localConfig(FILE *cert, FILE *priv);
+size_t localBind(int fds[], size_t cap, const char *host, const char *port);
+size_t localUnix(int fds[], size_t cap, const char *path);
+struct tls *localAccept(int *fd, int bind);
 
 void serverConfig(bool insecure, const char *cert, const char *priv);
 int serverConnect(const char *host, const char *port);
diff --git a/listen.c b/local.c
index 727a1e1..eccd2e6 100644
--- a/listen.c
+++ b/local.c
@@ -53,7 +53,7 @@ static byte *readFile(size_t *len, FILE *file) {
 	return buf;
 }
 
-void listenConfig(FILE *cert, FILE *priv) {
+void localConfig(FILE *cert, FILE *priv) {
 	tls_free(server);
 	server = tls_server();
 	if (!server) errx(EX_SOFTWARE, "tls_server");
@@ -81,7 +81,7 @@ void listenConfig(FILE *cert, FILE *priv) {
 	tls_config_free(config);
 }
 
-size_t listenBind(int fds[], size_t cap, const char *host, const char *port) {
+size_t localBind(int fds[], size_t cap, const char *host, const char *port) {
 	struct addrinfo *head;
 	struct addrinfo hints = {
 		.ai_family = AF_UNSPEC,
@@ -124,7 +124,7 @@ static void unixUnlink(void) {
 	if (error) warn("unlinkat");
 }
 
-size_t listenUnix(int fds[], size_t cap, const char *path) {
+size_t localUnix(int fds[], size_t cap, const char *path) {
 	if (!cap) return 0;
 
 	int sock = socket(PF_UNIX, SOCK_STREAM, 0);
@@ -186,7 +186,7 @@ static int recvfd(int sock) {
 	return *(int *)CMSG_DATA(cmsg);
 }
 
-struct tls *listenAccept(int *fd, int bind) {
+struct tls *localAccept(int *fd, int bind) {
 	*fd = accept(bind, NULL, NULL);
 	if (*fd < 0) err(EX_IOERR, "accept");