summaryrefslogtreecommitdiff
path: root/include/socket.h
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-06-16 04:02:21 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-06-16 04:02:21 +0000
commit14db93e7cfd4f434731305ef6e8832880f642fc5 (patch)
treef2f1fc306efb2ce7ce62c5ac27a1cbef2f72fd93 /include/socket.h
parent2f12c298e8d932f0f7eba320db71f15ece9b4ae9 (diff)
Fix sockaddr length argument, BSD will complain if it doesn't exactly match the expected size
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11414 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/socket.h')
-rw-r--r--include/socket.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/socket.h b/include/socket.h
index c7b87d583..ddd453ac3 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -143,6 +143,12 @@ namespace irc
*/
CoreExport int OpenTCPSocket(const char* addr, int socktype = SOCK_STREAM);
+ /** Return the size of the structure for syscall passing */
+ int sa_size(irc::sockets::sockaddrs& sa)
+ {
+ return sa.sa.sa_family == AF_INET ? sizeof(sa.in4) : sizeof(sa.in6);
+ }
+
/** Convert an address-port pair into a binary sockaddr
* @param addr The IP address, IPv4 or IPv6
* @param port The port, 0 for unspecified