Ruby  2.1.10p492(2016-04-01revision54464)
Macros | Functions | Variables
option.c File Reference
#include "rubysocket.h"

Go to the source code of this file.

Macros

#define inspect_ipv4_multicast_loop(a, b, c, d)   inspect_int(a,b,c,d)
 
#define inspect_ipv4_multicast_ttl(a, b, c, d)   inspect_int(a,b,c,d)
 
#define IFNAMSIZ   (sizeof(unsigned int)*3+1)
 

Functions

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_errno (int level, int optname, VALUE data, VALUE ret)
 
static int inspect_timeval_as_interval (int level, int optname, VALUE data, VALUE ret)
 
static 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
 

Macro Definition Documentation

◆ IFNAMSIZ

#define IFNAMSIZ   (sizeof(unsigned int)*3+1)

◆ inspect_ipv4_multicast_loop

#define inspect_ipv4_multicast_loop (   a,
  b,
  c,
 
)    inspect_int(a,b,c,d)

Definition at line 409 of file option.c.

Referenced by sockopt_inspect().

◆ inspect_ipv4_multicast_ttl

#define inspect_ipv4_multicast_ttl (   a,
  b,
  c,
 
)    inspect_int(a,b,c,d)

Definition at line 472 of file option.c.

Referenced by sockopt_inspect().

Function Documentation

◆ constant_to_sym()

static VALUE constant_to_sym ( int  constant,
ID(*)(int)  intern_const 
)
static

Definition at line 6 of file option.c.

References ID2SYM, INT2NUM, and name.

Referenced by optname_to_sym().

◆ inet_ntop()

static const char* inet_ntop ( int  af,
const void *  addr,
char *  numaddr,
size_t  numaddr_len 
)
static

Definition at line 633 of file option.c.

References snprintf.

◆ inspect_errno()

static int inspect_errno ( int  level,
int  optname,
VALUE  data,
VALUE  ret 
)
static

Definition at line 504 of file option.c.

References err, rb_str_catf(), RSTRING_LEN, RSTRING_PTR, and strerror().

Referenced by sockopt_inspect().

◆ inspect_int()

static int inspect_int ( int  level,
int  optname,
VALUE  data,
VALUE  ret 
)
static

Definition at line 476 of file option.c.

References rb_str_catf(), RSTRING_LEN, and RSTRING_PTR.

Referenced by sockopt_inspect().

◆ inspect_timeval_as_interval()

static int inspect_timeval_as_interval ( int  level,
int  optname,
VALUE  data,
VALUE  ret 
)
static

Definition at line 578 of file option.c.

References rb_str_catf(), RSTRING_LEN, and RSTRING_PTR.

Referenced by sockopt_inspect().

◆ optname_to_sym()

static VALUE optname_to_sym ( int  level,
int  optname 
)
static

Definition at line 17 of file option.c.

References constant_to_sym(), INT2NUM, and level.

Referenced by sockopt_inspect().

◆ rb_if_indextoname()

static int rb_if_indextoname ( const char *  succ_prefix,
const char *  fail_prefix,
unsigned int  ifindex,
char *  buf,
size_t  len 
)
static

Definition at line 653 of file option.c.

References buf, IFNAMSIZ, NULL, and snprintf.

◆ rsock_init_sockopt()

void rsock_init_sockopt ( void  )

◆ rsock_sockopt_new()

VALUE rsock_sockopt_new ( int  family,
int  level,
int  optname,
VALUE  data 
)

◆ sockopt_bool()

static VALUE sockopt_bool ( VALUE  self)
static

Definition at line 268 of file option.c.

References Qfalse, Qtrue, rb_eTypeError, rb_raise(), RSTRING_LEN, RSTRING_PTR, sockopt_data(), and StringValue.

Referenced by rsock_init_sockopt().

◆ sockopt_byte()

static VALUE sockopt_byte ( VALUE  self)
static

◆ sockopt_data()

static VALUE sockopt_data ( VALUE  self)
static

◆ sockopt_family_m()

static VALUE sockopt_family_m ( VALUE  self)
static

◆ sockopt_initialize()

static VALUE sockopt_initialize ( VALUE  self,
VALUE  vfamily,
VALUE  vlevel,
VALUE  voptname,
VALUE  data 
)
static

◆ sockopt_inspect()

static VALUE sockopt_inspect ( VALUE  self)
static

◆ sockopt_int()

static VALUE sockopt_int ( VALUE  self)
static

◆ sockopt_ipv4_multicast_loop()

static VALUE sockopt_ipv4_multicast_loop ( VALUE  self)
static

◆ sockopt_ipv4_multicast_ttl()

static VALUE sockopt_ipv4_multicast_ttl ( VALUE  self)
static

◆ sockopt_level()

static int sockopt_level ( VALUE  self)
static

◆ sockopt_level_m()

static VALUE sockopt_level_m ( VALUE  self)
static

Definition at line 101 of file option.c.

References INT2NUM, and sockopt_level().

Referenced by rsock_init_sockopt(), and sockopt_inspect().

◆ sockopt_linger()

static VALUE sockopt_linger ( VALUE  self)
static

◆ sockopt_optname()

static int sockopt_optname ( VALUE  self)
static

◆ sockopt_optname_m()

static VALUE sockopt_optname_m ( VALUE  self)
static

Definition at line 122 of file option.c.

References INT2NUM, and sockopt_optname().

Referenced by rsock_init_sockopt(), and sockopt_inspect().

◆ sockopt_s_bool()

static VALUE sockopt_s_bool ( VALUE  klass,
VALUE  vfamily,
VALUE  vlevel,
VALUE  voptname,
VALUE  vbool 
)
static

◆ sockopt_s_byte()

static VALUE sockopt_s_byte ( VALUE  klass,
VALUE  vfamily,
VALUE  vlevel,
VALUE  voptname,
VALUE  vint 
)
static

◆ sockopt_s_int()

static VALUE sockopt_s_int ( VALUE  klass,
VALUE  vfamily,
VALUE  vlevel,
VALUE  voptname,
VALUE  vint 
)
static

◆ sockopt_s_ipv4_multicast_loop()

static VALUE sockopt_s_ipv4_multicast_loop ( VALUE  klass,
VALUE  value 
)
static

Definition at line 362 of file option.c.

References NUM2CHR, NUM2INT, rb_str_new(), rb_to_int(), and rsock_sockopt_new().

Referenced by rsock_init_sockopt().

◆ sockopt_s_ipv4_multicast_ttl()

static VALUE sockopt_s_ipv4_multicast_ttl ( VALUE  klass,
VALUE  value 
)
static

Definition at line 425 of file option.c.

References NUM2CHR, NUM2INT, rb_str_new(), rb_to_int(), and rsock_sockopt_new().

Referenced by rsock_init_sockopt().

◆ sockopt_s_linger()

static VALUE sockopt_s_linger ( VALUE  klass,
VALUE  vonoff,
VALUE  vsecs 
)
static

Definition at line 300 of file option.c.

References AF_UNSPEC, NIL_P, NUM2INT, rb_check_to_integer(), rb_str_new(), rsock_sockopt_new(), and RTEST.

Referenced by rsock_init_sockopt().

◆ sockopt_unpack()

static VALUE sockopt_unpack ( VALUE  self,
VALUE  template 
)
static

Definition at line 1086 of file option.c.

References rb_funcall(), rb_intern, and sockopt_data().

Referenced by rsock_init_sockopt().

Variable Documentation

◆ rb_cSockOpt

VALUE rb_cSockOpt

Definition at line 3 of file option.c.

Referenced by rsock_init_sockopt(), and rsock_sockopt_new().