summaryrefslogtreecommitdiff
path: root/dwsock.h
diff options
context:
space:
mode:
authorDave Hibberd <d@vehibberd.com>2023-09-12 21:38:15 +0100
committerDave Hibberd <d@vehibberd.com>2023-09-12 21:38:15 +0100
commit3cdcbeea3e2891f4a10c79b272da144f37ff24f3 (patch)
treedc2daaabc2ba68cc125fc21bd35f8e67bdb0499e /dwsock.h
parentf7fc865d93f8448779d320ce152f0fa44a64fcad (diff)
New upstream version 0.67upstream/0.67
Diffstat (limited to 'dwsock.h')
-rw-r--r--dwsock.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/dwsock.h b/dwsock.h
new file mode 100644
index 0000000..986f6a2
--- /dev/null
+++ b/dwsock.h
@@ -0,0 +1,21 @@
+
+/* dwsock.h - Socket helper functions. */
+
+#ifndef DWSOCK_H
+#define DWSOCK_H 1
+
+#define DWSOCK_IPADDR_LEN 48 // Size of string to hold IPv4 or IPv6 address.
+ // I think 40 would be adequate but we'll make
+ // it a little larger just to be safe.
+ // Use INET6_ADDRSTRLEN (from netinet/in.h) instead?
+
+int dwsock_init (void);
+
+int dwsock_connect (char *hostname, char *port, char *description, int allow_ipv6, int debug, char ipaddr_str[DWSOCK_IPADDR_LEN]);
+ /* ipaddr_str needs to be at least SOCK_IPADDR_LEN bytes */
+
+char *dwsock_ia_to_text (int Family, void * pAddr, char * pStringBuf, size_t StringBufSize);
+
+void dwsock_close (int fd);
+
+#endif \ No newline at end of file