summaryrefslogtreecommitdiff
path: root/sockets.h
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-04-18 01:58:02 +0200
committerLuke Bratch <luke@bratch.co.uk>2019-04-18 01:58:02 +0200
commit84b3f43a97da2b305cfa5c620aceec543168f6bc (patch)
treef6cda57d836c6e606648e135d300016510c8e115 /sockets.h
parent7d5fbb2c855ebe7e2a0dc373bfd3943e4728c750 (diff)
Split functions into different files
Diffstat (limited to 'sockets.h')
-rw-r--r--sockets.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/sockets.h b/sockets.h
new file mode 100644
index 0000000..3c8fcbf
--- /dev/null
+++ b/sockets.h
@@ -0,0 +1,29 @@
+#ifndef SOCKETS_H_INCLUDED
+#define SOCKETS_H_INCLUDED
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <netdb.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <sys/select.h>
+
+#define BACKLOG 10 // maximum length to which the queue of pending connections for sockfd may grow
+
+#define BOUNCERLISTENPORT "1234" // TODO: change this to a config option!
+
+// get sockaddr, IPv4 or IPv6:
+void *get_in_addr(struct sockaddr *sa);
+
+// Create socket to connect to real IRC server
+int createserversocket(char *host, char *port);
+
+// Create listening socket to listen for bouncer client connections
+int createclientsocket(char *listenport);
+
+#endif