From 1b81dafdd5601dbfe0818b4ddc1c4a53ecd0270d Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 23 Feb 2014 02:54:04 +0000 Subject: win32/win32.c: add rb_w32_inet_pton * include/ruby/win32.h, win32/win32.c (rb_w32_inet_pton): add a wrapper function for inet_pton minimum supported client is Vista, as well as inet_ntop. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/win32.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'win32/win32.c') diff --git a/win32/win32.c b/win32/win32.c index 2c888ae4c4..fbfbc37683 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -6958,6 +6958,19 @@ rb_w32_inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len) return numaddr; } +/* License: Ruby's */ +int WSAAPI +rb_w32_inet_pton(int af, const char *src, void *dst) +{ + typedef int (WSAAPI inet_pton_t)(int, const char*, void *); + inet_pton_t *pInetPton; + pInetPton = (inet_pton_t *)get_proc_address("ws2_32", "inet_pton", NULL); + if (pInetPton) { + return pInetPton(af, src, dst); + } + return 0; +} + /* License: Ruby's */ char rb_w32_fd_is_text(int fd) -- cgit v1.2.3