summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-29 03:21:15 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-29 03:21:15 +0000
commit3df81381bcfee4531599ddb417a31e7efca2528e (patch)
tree0086d1a670ae5932229d5724f05c36fadfd067ca /include
parentd2a71fd3447c8bac65cc26077e2b9fc3fb0b28a7 (diff)
Add IP address conversion utility functions, irc::sockets::aptosa and irc::sockets::satoap
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11336 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/socket.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/socket.h b/include/socket.h
index 11c536ed7..a4e9cf43b 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -142,6 +142,21 @@ namespace irc
* descriptors)
*/
CoreExport int OpenTCPSocket(const char* addr, int socktype = SOCK_STREAM);
+
+ /** Convert an address-port pair into a binary sockaddr
+ * @param addr The IP address, IPv4 or IPv6
+ * @param port The port, 0 for unspecified
+ * @param sa The structure to place the result in. Will be zeroed prior to conversion
+ * @return true if the conversion was successful, false if not.
+ */
+ CoreExport int aptosa(const char* addr, int port, irc::sockets::sockaddrs* sa);
+ /** Convert a binary sockaddr to an address-port pair
+ * @param sa The structure to convert
+ * @param addr the IP address
+ * @param port the port
+ * @return true if the conversion was successful, false if unknown address family
+ */
+ CoreExport int satoap(const irc::sockets::sockaddrs* sa, std::string& addr, int &port);
}
}