49 const char *syscall = 0;
60 family, SOCK_STREAM, 0);
65 #if !defined(INET6) && defined(AF_INET6) 84 syscall =
"socket(2)";
92 #if !defined(_WIN32) && !defined(__CYGWIN__) 94 setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
95 (
char*)&status, (
socklen_t)
sizeof(status));
110 syscall =
"connect(2)";
166 inetsock_cleanup, (
VALUE)&arg);
169 static ID id_numeric, id_hostname;
174 #define return_norevlookup(x) {*norevlookup = (x); return 1;} 189 #undef return_norevlookup 206 if (fptr && fptr->
fd >= 0 &&
207 getsockname(fptr->
fd, &addr.
addr, &len) >= 0 &&
210 char hbuf[1024], pbuf[1024];
264 if (getsockname(fptr->
fd, &addr.
addr, &len) < 0)
305 if (getpeername(fptr->
fd, &addr.
addr, &len) < 0)
void rb_syserr_fail(int e, const char *mesg)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
void rb_raise(VALUE exc, const char *fmt,...)
VALUE rb_str_cat(VALUE, const char *, long)
VALUE rsock_make_ipaddr(struct sockaddr *addr, socklen_t addrlen)
VALUE rsock_init_sock(VALUE sock, int fd)
#define FMODE_NOREVLOOKUP
VALUE rsock_ipaddr(struct sockaddr *sockaddr, socklen_t sockaddrlen, int norevlookup)
VALUE rb_ensure(VALUE(*b_proc)(ANYARGS), VALUE data1, VALUE(*e_proc)(ANYARGS), VALUE data2)
An equivalent to ensure clause.
void rb_undef_method(VALUE klass, const char *name)
#define GetOpenFile(obj, fp)
void rb_freeaddrinfo(struct rb_addrinfo *ai)
void rsock_syserr_fail_host_port(int err, const char *mesg, VALUE host, VALUE port)
struct rb_addrinfo * rsock_addrinfo(VALUE host, VALUE port, int family, int socktype, int flags)
int rsock_socket(int domain, int type, int proto)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
void rb_sys_fail(const char *mesg)
VALUE rb_str_subseq(VALUE, long, long)
VALUE rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
ID rsock_intern_family(int val)
VALUE rb_call_super(int, const VALUE *)
const char * rb_id2name(ID)
struct inetsock_arg::@47 local
register unsigned int len
int rb_getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags)
int rsock_revlookup_flag(VALUE revlookup, int *norevlookup)
#define return_norevlookup(x)
int rsock_connect(int fd, const struct sockaddr *sockaddr, int len, int socks)
VALUE rb_str_cat_cstr(VALUE, const char *)
struct addrinfo * ai_next
VALUE rsock_init_inetsock(VALUE sock, VALUE remote_host, VALUE remote_serv, VALUE local_host, VALUE local_serv, int type)
void rsock_init_ipsocket(void)
#define rb_intern_const(str)
struct inetsock_arg::@47 remote
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
VALUE rb_str_append(VALUE, VALUE)
struct sockaddr * ai_addr