Ruby: ext/socket/option.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions | Variables
option.c File Reference
`#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
VALUE | rsock_sockopt_new (int family, int level, int optname, VALUE data)
const char * | inet_ntop (int af, const void *addr, char *numaddr, size_t numaddr_len)
void | rsock_init_sockopt (void)

## Variables
VALUE | rb_cSockOpt

## Macro Definition Documentation

## ◆ CAT

#define CAT | ( |  | x,
|  |  | y
| ) |  | x##y

Definition at line 7 of file option.c.

## ◆ check_size

#define check_size | ( |  | len,
|  |  | size
| ) |  |

Value:
((len) == (size) ? \
(void)0 : \
rb_raise(rb_eTypeError, "size differ. expected as "#size"=%d but %ld", \
(int)size, (long)(len)))
len
uint8_t len
Definition: escape.c:17
rb_raise
void rb_raise(VALUE exc, const char *fmt,...)
Definition: error.c:2917
rb_eTypeError
VALUE rb_eTypeError
Definition: error.c:1057
size
voidpf void uLong size
Definition: ioapi.h:138
long
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque

Definition at line 30 of file option.c.

## ◆ IFNAMSIZ

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

## ◆ inspect_ipv4_multicast_loop

#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.

## ◆ inspect_ipv4_multicast_ttl

#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.

## ◆ pack_var

#define pack_var | ( |  | v | ) | rb_str_new((const char *)&(v), sizeof(v))

Definition at line 5 of file option.c.

## ◆ TYPE_IP_MULTICAST_LOOP

#define TYPE_IP_MULTICAST_LOOP byte

Definition at line 25 of file option.c.

## ◆ TYPE_IP_MULTICAST_TTL

#define TYPE_IP_MULTICAST_TTL byte

Definition at line 26 of file option.c.

## ◆ USE_INSPECT_BYTE

#define USE_INSPECT_BYTE 1

Definition at line 27 of file option.c.

## ◆ XCAT

#define XCAT | ( |  | x,
|  |  | y
| ) |  | CAT(x,y)

Definition at line 8 of file option.c.

## Function Documentation

## ◆ inet_ntop()

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

Definition at line 651 of file option.c.

References in(), memcpy, and snprintf.

Referenced by getnameinfo().

## ◆ rsock_init_sockopt()

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, and rb_define_singleton_method.

Referenced by rsock_init_socket_init().

## ◆ rsock_sockopt_new()

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

Definition at line 107 of file option.c.

References INT2NUM, rb_cSockOpt, rb_obj_alloc(), and StringValue.

## Variable Documentation

## ◆ rb_cSockOpt

VALUE rb_cSockOpt

Definition at line 3 of file option.c.

Referenced by rsock_init_sockopt(), and rsock_sockopt_new().