summaryrefslogtreecommitdiff
path: root/ext/socket/rubysocket.h
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-06 05:50:42 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-06 05:50:42 +0000
commitcb302bf35109d69063ac589dd75f6356257a7fda (patch)
tree81429547230c946933771a24a4b98e7a6dd9e3aa /ext/socket/rubysocket.h
parentb1fd376cbfbccc523921a950b1bc6bcaa01c0f99 (diff)
* ext/socket/rubysocket.h (SockAddrStringValueWithAddrinfo): New macro.
(rsock_sockaddr_string_value_with_addrinfo): New declaration. (rsock_addrinfo_inspect_sockaddr): Ditto. (rsock_sys_fail_addrinfo): Ditto. (rsock_sys_fail_sockaddr_or_addrinfo): Ditto. * ext/socket/raddrinfo.c (rsock_addrinfo_inspect_sockaddr): Renamed from addrinfo_inspect_sockaddr and exported. (rsock_sockaddr_string_value_with_addrinfo): New function to obtain string and possibly addrinfo object. * ext/socket/socket.c (rsock_sys_fail_sockaddr): Don't use rsock_sys_fail_host_port which is IP dependent. Invoke rsock_sys_fail_addrinfo. (rsock_sys_fail_addrinfo): New function using rsock_addrinfo_inspect_sockaddr. (rsock_sys_fail_addrinfo_or_sockaddr): New function. (sock_connect): Use SockAddrStringValueWithAddrinfo and rsock_sys_fail_addrinfo_or_sockaddr. (sock_connect_nonblock): Ditto. (sock_bind): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/rubysocket.h')
-rw-r--r--ext/socket/rubysocket.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h
index 5dd742b..133276c 100644
--- a/ext/socket/rubysocket.h
+++ b/ext/socket/rubysocket.h
@@ -227,8 +227,11 @@ int Rconnect();
#define SockAddrStringValue(v) rsock_sockaddr_string_value(&(v))
#define SockAddrStringValuePtr(v) rsock_sockaddr_string_value_ptr(&(v))
+#define SockAddrStringValueWithAddrinfo(v, rai_ret) rsock_sockaddr_string_value_with_addrinfo(&(v), &(rai_ret))
VALUE rsock_sockaddr_string_value(volatile VALUE *);
char *rsock_sockaddr_string_value_ptr(volatile VALUE *);
+VALUE rsock_sockaddr_string_value_with_addrinfo(volatile VALUE *v, VALUE *ai_ret);
+
VALUE rb_check_sockaddr_string_type(VALUE);
NORETURN(void rsock_raise_socket_error(const char *, int));
@@ -250,6 +253,7 @@ VALUE rsock_fd_socket_addrinfo(int fd, struct sockaddr *addr, socklen_t len);
VALUE rsock_io_socket_addrinfo(VALUE io, struct sockaddr *addr, socklen_t len);
VALUE rsock_addrinfo_new(struct sockaddr *addr, socklen_t len, int family, int socktype, int protocol, VALUE canonname, VALUE inspectname);
+VALUE rsock_addrinfo_inspect_sockaddr(VALUE rai);
VALUE rsock_make_ipaddr(struct sockaddr *addr, socklen_t addrlen);
VALUE rsock_ipaddr(struct sockaddr *sockaddr, socklen_t sockaddrlen, int norevlookup);
@@ -335,6 +339,8 @@ void rsock_init_socket_init(void);
NORETURN(void rsock_sys_fail_host_port(const char *, VALUE, VALUE));
NORETURN(void rsock_sys_fail_path(const char *, VALUE));
-NORETURN(void rsock_sys_fail_sockaddr(const char *, VALUE));
+NORETURN(void rsock_sys_fail_sockaddr(const char *, VALUE addr));
+NORETURN(void rsock_sys_fail_addrinfo(const char *, VALUE rai));
+NORETURN(void rsock_sys_fail_sockaddr_or_addrinfo(const char *, VALUE addr, VALUE rai));
#endif