210 int family,
level, option;
241 v = (
char*)&i; vlen = (int)
sizeof(i);
250 #define rb_sys_fail_path(path) rb_sys_fail_str(path)
253 if (setsockopt(fptr->
fd, level, option, v, vlen) < 0)
259 #if !defined(__BEOS__)
334 if (getsockopt(fptr->
fd, level, option, buf, &len) < 0)
340 #define bsock_getsockopt rb_f_notimplement
360 socklen_t len = (socklen_t)
sizeof buf;
361 socklen_t len0 = len;
365 if (getsockname(fptr->
fd, (
struct sockaddr*)&buf, &len) < 0)
367 if (len0 < len) len = len0;
391 socklen_t len = (socklen_t)
sizeof buf;
392 socklen_t len0 = len;
396 if (getpeername(fptr->
fd, (
struct sockaddr*)&buf, &len) < 0)
398 if (len0 < len) len = len0;
402 #if defined(HAVE_GETPEEREID) || defined(SO_PEERCRED) || defined(HAVE_GETPEERUCRED)
428 #if defined(HAVE_GETPEEREID)
433 if (getpeereid(fptr->
fd, &euid, &egid) == -1)
436 #elif defined(SO_PEERCRED)
439 socklen_t len =
sizeof(cred);
441 if (getsockopt(fptr->
fd, SOL_SOCKET, SO_PEERCRED, &cred, &len) == -1)
444 #elif defined(HAVE_GETPEERUCRED)
449 if (getpeerucred(fptr->
fd, &uc) == -1)
457 #define bsock_getpeereid rb_f_notimplement
481 socklen_t len = (socklen_t)
sizeof buf;
482 socklen_t len0 = len;
486 if (getsockname(fptr->
fd, (
struct sockaddr*)&buf, &len) < 0)
488 if (len0 < len) len = len0;
515 socklen_t len = (socklen_t)
sizeof buf;
516 socklen_t len0 = len;
520 if (getpeername(fptr->
fd, (
struct sockaddr*)&buf, &len) < 0)
522 if (len0 < len) len = len0;
static VALUE bsock_recv(int argc, VALUE *argv, VALUE sock)
VALUE rsock_sendto_blocking(void *data)
#define SockAddrStringValue(v)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
VALUE rb_blocking_function_t(void *)
static VALUE bsock_do_not_rev_lookup_set(VALUE self, VALUE val)
VALUE rsock_init_sock(VALUE sock, int fd)
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
void rb_raise(VALUE exc, const char *fmt,...)
#define rsock_bsock_sendmsg
static VALUE bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname)
#define FMODE_NOREVLOOKUP
int rsock_getfamily(int sockfd)
void rb_undef_method(VALUE klass, const char *name)
#define GetOpenFile(obj, fp)
static VALUE bsock_getsockname(VALUE sock)
VALUE rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
static VALUE bsock_s_for_fd(VALUE klass, VALUE fd)
static VALUE bsock_close_write(VALUE sock)
static VALUE bsock_getpeername(VALUE sock)
static VALUE bsock_setsockopt(int argc, VALUE *argv, VALUE sock)
VALUE rsock_sockopt_new(int family, int level, int optname, VALUE data)
#define rsock_bsock_sendmsg_nonblock
static VALUE bsock_close_read(VALUE sock)
static VALUE bsock_recv_nonblock(int argc, VALUE *argv, VALUE sock)
VALUE rsock_send_blocking(void *data)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
int rsock_level_arg(int family, VALUE level)
int rb_io_wait_writable(int)
#define rsock_bsock_recvmsg_nonblock
#define ALLOCA_N(type, n)
static VALUE bsock_remote_address(VALUE sock)
static VALUE bsock_shutdown(int argc, VALUE *argv, VALUE sock)
SSL_METHOD *(* func)(void)
VALUE rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
VALUE rsock_fd_socket_addrinfo(int fd, struct sockaddr *addr, socklen_t len)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
unsigned char buf[MIME_BUF_SIZE]
VALUE rb_assoc_new(VALUE car, VALUE cdr)
void rsock_init_basicsocket(void)
int rsock_do_not_reverse_lookup
void rb_sys_fail(const char *mesg)
static VALUE bsock_do_not_rev_lookup(void)
static VALUE bsock_do_not_reverse_lookup_set(VALUE sock, VALUE state)
int rsock_optname_arg(int family, int level, VALUE optname)
#define RSTRING_LENINT(str)
VALUE rb_str_new(const char *, long)
VALUE rb_obj_alloc(VALUE)
static VALUE bsock_do_not_reverse_lookup(VALUE sock)
#define rb_sys_fail_path(path)
#define rsock_bsock_recvmsg
int rsock_shutdown_how_arg(VALUE how)
VALUE rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
int rb_thread_fd_writable(int)
void rb_io_check_closed(rb_io_t *)
#define BLOCKING_REGION_FD(func, arg)
static VALUE bsock_local_address(VALUE sock)