Ruby
2.4.2p198(2017-09-14revision59899)
|
#include "rubysocket.h"
Go to the source code of this file.
Macros | |
#define | pack_var(v) rb_str_new((const char *)&(v), sizeof(v)) |
#define | CAT(x, y) x##y |
#define | XCAT(x, y) CAT(x,y) |
#define | TYPE_IP_MULTICAST_LOOP byte |
#define | TYPE_IP_MULTICAST_TTL byte |
#define | USE_INSPECT_BYTE 1 |
#define | check_size(len, size) |
#define | inspect_ipv4_multicast_loop(a, b, c, d) XCAT(inspect_,TYPE_IP_MULTICAST_LOOP)(a,b,c,d) |
#define | inspect_ipv4_multicast_ttl(a, b, c, d) XCAT(inspect_,TYPE_IP_MULTICAST_TTL)(a,b,c,d) |
#define | IFNAMSIZ (sizeof(unsigned int)*3+1) |
Functions | |
static VALUE | sockopt_pack_byte (VALUE value) |
static VALUE | sockopt_pack_int (VALUE value) |
static VALUE | constant_to_sym (int constant, ID(*intern_const)(int)) |
static VALUE | optname_to_sym (int level, int optname) |
static VALUE | sockopt_initialize (VALUE self, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE data) |
VALUE | rsock_sockopt_new (int family, int level, int optname, VALUE data) |
static VALUE | sockopt_family_m (VALUE self) |
static int | sockopt_level (VALUE self) |
static VALUE | sockopt_level_m (VALUE self) |
static int | sockopt_optname (VALUE self) |
static VALUE | sockopt_optname_m (VALUE self) |
static VALUE | sockopt_data (VALUE self) |
static VALUE | sockopt_s_byte (VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vint) |
static VALUE | sockopt_byte (VALUE self) |
static VALUE | sockopt_s_int (VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vint) |
static VALUE | sockopt_int (VALUE self) |
static VALUE | sockopt_s_bool (VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vbool) |
static VALUE | sockopt_bool (VALUE self) |
static VALUE | sockopt_s_linger (VALUE klass, VALUE vonoff, VALUE vsecs) |
static VALUE | sockopt_linger (VALUE self) |
static VALUE | sockopt_s_ipv4_multicast_loop (VALUE klass, VALUE value) |
static VALUE | sockopt_ipv4_multicast_loop (VALUE self) |
static VALUE | sockopt_s_ipv4_multicast_ttl (VALUE klass, VALUE value) |
static VALUE | sockopt_ipv4_multicast_ttl (VALUE self) |
static int | inspect_int (int level, int optname, VALUE data, VALUE ret) |
static int | inspect_byte (int level, int optname, VALUE data, VALUE ret) |
static int | inspect_errno (int level, int optname, VALUE data, VALUE ret) |
static int | inspect_timeval_as_interval (int level, int optname, VALUE data, VALUE ret) |
const char * | inet_ntop (int af, const void *addr, char *numaddr, size_t numaddr_len) |
static int | rb_if_indextoname (const char *succ_prefix, const char *fail_prefix, unsigned int ifindex, char *buf, size_t len) |
static VALUE | sockopt_inspect (VALUE self) |
static VALUE | sockopt_unpack (VALUE self, VALUE template) |
void | rsock_init_sockopt (void) |
Variables | |
VALUE | rb_cSockOpt |
Definition at line 30 of file option.c.
Referenced by sockopt_bool(), sockopt_byte(), sockopt_int(), and sockopt_linger().
#define IFNAMSIZ (sizeof(unsigned int)*3+1) |
Referenced by getifaddrs(), init_constants(), rb_if_indextoname(), and rsock_inspect_sockaddr().
#define inspect_ipv4_multicast_loop | ( | a, | |
b, | |||
c, | |||
d | |||
) | XCAT(inspect_,TYPE_IP_MULTICAST_LOOP)(a,b,c,d) |
Definition at line 430 of file option.c.
Referenced by sockopt_inspect().
#define inspect_ipv4_multicast_ttl | ( | a, | |
b, | |||
c, | |||
d | |||
) | XCAT(inspect_,TYPE_IP_MULTICAST_TTL)(a,b,c,d) |
Definition at line 481 of file option.c.
Referenced by sockopt_inspect().
#define pack_var | ( | v | ) | rb_str_new((const char *)&(v), sizeof(v)) |
Definition at line 5 of file option.c.
Referenced by sockopt_pack_byte(), sockopt_pack_int(), sockopt_s_bool(), and sockopt_s_linger().
#define TYPE_IP_MULTICAST_LOOP byte |
Definition at line 25 of file option.c.
Referenced by sockopt_ipv4_multicast_loop(), and sockopt_s_ipv4_multicast_loop().
#define TYPE_IP_MULTICAST_TTL byte |
Definition at line 26 of file option.c.
Referenced by sockopt_ipv4_multicast_ttl(), and sockopt_s_ipv4_multicast_ttl().
#define XCAT | ( | x, | |
y | |||
) | CAT(x,y) |
Definition at line 8 of file option.c.
Referenced by sockopt_ipv4_multicast_loop(), sockopt_ipv4_multicast_ttl(), sockopt_s_ipv4_multicast_loop(), and sockopt_s_ipv4_multicast_ttl().
Definition at line 651 of file option.c.
References memcpy, and snprintf.
Referenced by getnameinfo(), and rb_if_indextoname().
Definition at line 500 of file option.c.
References rb_str_catf(), RSTRING_LEN, and RSTRING_PTR.
Definition at line 513 of file option.c.
References err, id, level, memcpy, rb_id2name(), rb_str_cat2(), rb_str_catf(), rsock_intern_socktype(), RSTRING_LEN, RSTRING_PTR, and strerror().
Referenced by sockopt_inspect().
Definition at line 485 of file option.c.
References memcpy, rb_str_catf(), RSTRING_LEN, and RSTRING_PTR.
Referenced by sockopt_inspect().
Definition at line 587 of file option.c.
References memcpy, rb_str_catf(), RSTRING_LEN, and RSTRING_PTR.
Referenced by sockopt_inspect().
|
static |
Definition at line 62 of file option.c.
References constant_to_sym(), INT2NUM, IPPROTO_IP, IPPROTO_TCP, IPPROTO_UDP, rsock_intern_ip_optname(), rsock_intern_ipv6_optname(), rsock_intern_so_optname(), rsock_intern_tcp_optname(), and rsock_intern_udp_optname().
Referenced by sockopt_inspect().
|
static |
Definition at line 669 of file option.c.
References IFNAMSIZ, INET6_ADDRSTRLEN, INET_ADDRSTRLEN, inet_ntop(), memcpy, NULL, options(), rb_str_cat2(), rb_str_cat_cstr(), rb_str_catf(), RSTRING_LEN, RSTRING_PTR, and snprintf.
void rsock_init_sockopt | ( | void | ) |
Definition at line 1438 of file option.c.
References rb_cObject, rb_cSocket, rb_cSockOpt, rb_define_class_under(), rb_define_method(), rb_define_singleton_method(), sockopt_bool(), sockopt_byte(), sockopt_data(), sockopt_family_m(), sockopt_initialize(), sockopt_inspect(), sockopt_int(), sockopt_ipv4_multicast_loop(), sockopt_ipv4_multicast_ttl(), sockopt_level_m(), sockopt_linger(), sockopt_optname_m(), sockopt_s_bool(), sockopt_s_byte(), sockopt_s_int(), sockopt_s_ipv4_multicast_loop(), sockopt_s_ipv4_multicast_ttl(), sockopt_s_linger(), and sockopt_unpack().
Referenced by rsock_init_socket_init().
Definition at line 107 of file option.c.
References INT2NUM, NEWOBJ_OF, rb_cSockOpt, sockopt_initialize(), StringValue, and T_OBJECT.
Referenced by bsock_getsockopt(), sockopt_s_bool(), sockopt_s_byte(), sockopt_s_int(), sockopt_s_ipv4_multicast_loop(), sockopt_s_ipv4_multicast_ttl(), and sockopt_s_linger().
Definition at line 304 of file option.c.
References check_size, len, memcpy, Qfalse, Qtrue, RSTRING_LEN, RSTRING_PTR, sockopt_data(), and StringValue.
Referenced by rsock_init_sockopt().
Definition at line 218 of file option.c.
References check_size, CHR2FIX, RSTRING_LEN, RSTRING_PTR, sockopt_data(), and StringValue.
Referenced by rsock_init_sockopt().
Definition at line 183 of file option.c.
References rb_attr_get(), rb_intern, and StringValue.
Referenced by rsock_init_sockopt(), sockopt_bool(), sockopt_byte(), sockopt_inspect(), sockopt_int(), sockopt_linger(), and sockopt_unpack().
Definition at line 125 of file option.c.
References rb_attr_get(), and rb_intern.
Referenced by rsock_init_sockopt(), sockopt_inspect(), sockopt_ipv4_multicast_loop(), and sockopt_ipv4_multicast_ttl().
|
static |
Definition at line 93 of file option.c.
References INT2NUM, level, rb_intern, rb_ivar_set(), rsock_family_arg(), rsock_level_arg(), rsock_optname_arg(), and StringValue.
Referenced by rsock_init_sockopt(), and rsock_sockopt_new().
Definition at line 1203 of file option.c.
References AF_UNSPEC, inspect_errno(), inspect_int(), inspect_ipv4_multicast_loop, inspect_ipv4_multicast_ttl, inspect_timeval_as_interval(), IPPROTO_IP, IPPROTO_TCP, IS_IP_FAMILY, NUM2INT, optname_to_sym(), PRIsVALUE, rb_id2name(), rb_obj_classname(), rb_sprintf(), rb_str_append(), rb_str_cat2(), rb_str_catf(), rb_str_dump(), rb_sym2str, rsock_intern_family_noprefix(), rsock_intern_iplevel(), rsock_intern_local_optname(), rsock_intern_so_optname(), sockopt_data(), sockopt_family_m(), sockopt_level_m(), sockopt_optname_m(), StringValue, and SYMBOL_P.
Referenced by rsock_init_sockopt().
Definition at line 258 of file option.c.
References check_size, INT2NUM, memcpy, RSTRING_LEN, RSTRING_PTR, sockopt_data(), and StringValue.
Referenced by rsock_init_sockopt().
Definition at line 415 of file option.c.
References IPPROTO_IP, level, NUM2INT, rb_eTypeError, rb_raise(), sockopt_family_m(), sockopt_level(), sockopt_optname(), TYPE_IP_MULTICAST_LOOP, UNREACHABLE, and XCAT.
Referenced by rsock_init_sockopt().
Definition at line 466 of file option.c.
References IPPROTO_IP, level, NUM2INT, rb_eTypeError, rb_raise(), sockopt_family_m(), sockopt_level(), sockopt_optname(), TYPE_IP_MULTICAST_TTL, UNREACHABLE, and XCAT.
Referenced by rsock_init_sockopt().
|
static |
Definition at line 131 of file option.c.
References NUM2INT, rb_attr_get(), and rb_intern.
Referenced by sockopt_ipv4_multicast_loop(), sockopt_ipv4_multicast_ttl(), sockopt_level_m(), and sockopt_linger().
Definition at line 146 of file option.c.
References INT2NUM, and sockopt_level().
Referenced by rsock_init_sockopt(), and sockopt_inspect().
Definition at line 357 of file option.c.
References check_size, INT2NUM, level, memcpy, Qfalse, Qtrue, rb_assoc_new(), rb_eTypeError, rb_raise(), RSTRING_LEN, RSTRING_PTR, sockopt_data(), sockopt_level(), and sockopt_optname().
Referenced by rsock_init_sockopt().
|
static |
Definition at line 152 of file option.c.
References NUM2INT, rb_attr_get(), and rb_intern.
Referenced by sockopt_ipv4_multicast_loop(), sockopt_ipv4_multicast_ttl(), sockopt_linger(), and sockopt_optname_m().
Definition at line 167 of file option.c.
References INT2NUM, and sockopt_optname().
Referenced by rsock_init_sockopt(), and sockopt_inspect().
Definition at line 37 of file option.c.
References NUM2CHR, pack_var, and rb_to_int().
Referenced by sockopt_s_byte().
Definition at line 44 of file option.c.
References NUM2INT, pack_var, and rb_to_int().
Referenced by sockopt_s_int().
|
static |
Definition at line 285 of file option.c.
References level, pack_var, rsock_family_arg(), rsock_level_arg(), rsock_optname_arg(), rsock_sockopt_new(), and RTEST.
Referenced by rsock_init_sockopt().
|
static |
Definition at line 200 of file option.c.
References level, rsock_family_arg(), rsock_level_arg(), rsock_optname_arg(), rsock_sockopt_new(), and sockopt_pack_byte().
Referenced by rsock_init_sockopt().
|
static |
Definition at line 238 of file option.c.
References level, rsock_family_arg(), rsock_level_arg(), rsock_optname_arg(), rsock_sockopt_new(), and sockopt_pack_int().
Referenced by rsock_init_sockopt().
Definition at line 394 of file option.c.
References IPPROTO_IP, rsock_sockopt_new(), TYPE_IP_MULTICAST_LOOP, and XCAT.
Referenced by rsock_init_sockopt().
Definition at line 446 of file option.c.
References IPPROTO_IP, rsock_sockopt_new(), TYPE_IP_MULTICAST_TTL, and XCAT.
Referenced by rsock_init_sockopt().
Definition at line 334 of file option.c.
References AF_UNSPEC, NIL_P, NUM2INT, pack_var, rb_check_to_integer(), rsock_sockopt_new(), and RTEST.
Referenced by rsock_init_sockopt().
Definition at line 1432 of file option.c.
References rb_funcall(), rb_intern, and sockopt_data().
Referenced by rsock_init_sockopt().
VALUE rb_cSockOpt |
Definition at line 3 of file option.c.
Referenced by rsock_init_sockopt(), and rsock_sockopt_new().