summaryrefslogtreecommitdiff
path: root/lib/rsp_util.h
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2010-11-11 10:30:35 +0100
committerLinus Nordberg <linus@nordu.net>2010-11-11 10:30:35 +0100
commit83e82dba47aced4a93f9e431b4d8bca94c2f8517 (patch)
tree7ff1779ea924d557b6ded9bd21c0cc8a65f062dd /lib/rsp_util.h
parentf9b25cad24ec4e3e89e818457beb29cbe08eed0c (diff)
Bringing up TLS connections working.
NOTE: Clean up of resources not yet sane. Expect resource leakages. NOTE: Most failure cases are not handled properly. With the wind at your back and the sun shining, it might work.
Diffstat (limited to 'lib/rsp_util.h')
-rw-r--r--lib/rsp_util.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/rsp_util.h b/lib/rsp_util.h
new file mode 100644
index 0000000..d8d002c
--- /dev/null
+++ b/lib/rsp_util.h
@@ -0,0 +1,25 @@
+#include <sys/socket.h>
+#include <netdb.h>
+
+#define SOCKADDR_SIZE(addr) ((addr).ss_family == AF_INET ? \
+ sizeof(struct sockaddr_in) : \
+ sizeof(struct sockaddr_in6))
+
+#define SOCKADDRP_SIZE(addr) ((addr)->sa_family == AF_INET ? \
+ sizeof(struct sockaddr_in) : \
+ sizeof(struct sockaddr_in6))
+
+char *stringcopy(const char *s, int len);
+char *addr2string(struct sockaddr *addr);
+struct sockaddr *addr_copy(struct sockaddr *in);
+void port_set(struct sockaddr *sa, uint16_t port);
+
+void printfchars(char *prefixfmt, char *prefix, char *charfmt, char *chars, int len);
+void disable_DF_bit(int socket, struct addrinfo *res);
+int bindtoaddr(struct addrinfo *addrinfo, int family, int reuse, int v6only);
+int connecttcp(struct addrinfo *addrinfo, struct addrinfo *src, uint16_t timeout);
+
+
+/* Local Variables: */
+/* c-file-style: "stroustrup" */
+/* End: */