diff options
-rw-r--r-- | include/socket.h | 5 | ||||
-rw-r--r-- | src/socket.cpp | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/include/socket.h b/include/socket.h index ddd453ac3..4a91404e5 100644 --- a/include/socket.h +++ b/include/socket.h @@ -144,10 +144,7 @@ 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); - } + CoreExport int sa_size(irc::sockets::sockaddrs& sa); /** Convert an address-port pair into a binary sockaddr * @param addr The IP address, IPv4 or IPv6 diff --git a/src/socket.cpp b/src/socket.cpp index 8b016152d..cdf624321 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -326,3 +326,11 @@ int irc::sockets::satoap(const irc::sockets::sockaddrs* sa, std::string& addr, i return false; } +int irc::sockets::sa_size(irc::sockets::sockaddrs& sa) +{ + if (sa.sa.sa_family == AF_INET) + return sizeof(sa.in4); + if (sa.sa.sa_family == AF_INET6) + return sizeof(sa.in6); + return 0; +} |