Ruby: ext/socket/socket.c File Reference

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

Macros | Functions
socket.c File Reference
`#include "rubysocket.h"`

Go to the source code of this file.

## Macros
#define | rsock_sock_s_socketpair rb_f_notimplement
#define | sock_gethostname rb_f_notimplement
#define | socket_s_ip_address_list rb_f_notimplement

## Functions
void | rsock_sys_fail_host_port (const char *mesg, VALUE host, VALUE port)
void | rsock_syserr_fail_host_port (int err, const char *mesg, VALUE host, VALUE port)
void | rsock_sys_fail_path (const char *mesg, VALUE path)
void | rsock_syserr_fail_path (int err, const char *mesg, VALUE path)
void | rsock_sys_fail_sockaddr (const char *mesg, struct sockaddr *addr, socklen_t len)
void | rsock_syserr_fail_sockaddr (int err, const char *mesg, struct sockaddr *addr, socklen_t len)
void | rsock_sys_fail_raddrinfo (const char *mesg, VALUE rai)
void | rsock_syserr_fail_raddrinfo (int err, const char *mesg, VALUE rai)
void | rsock_sys_fail_raddrinfo_or_sockaddr (const char *mesg, VALUE addr, VALUE rai)
void | rsock_syserr_fail_raddrinfo_or_sockaddr (int err, const char *mesg, VALUE addr, VALUE rai)
VALUE | rsock_sock_listen (VALUE sock, VALUE log)
void | Init_socket (void)

## Macro Definition Documentation

## ◆ rsock_sock_s_socketpair

#define rsock_sock_s_socketpair rb_f_notimplement

Definition at line 271 of file socket.c.

## ◆ sock_gethostname

#define sock_gethostname rb_f_notimplement

Definition at line 895 of file socket.c.

## ◆ socket_s_ip_address_list

#define socket_s_ip_address_list rb_f_notimplement

Definition at line 1891 of file socket.c.

## Function Documentation

## ◆ Init_socket()

void Init_socket | ( | void |  | ) |

Definition at line 1895 of file socket.c.

References ID2SYM, rb_cBasicSocket, rb_cSocket, rb_define_class(), rb_define_method, rb_define_private_method, rb_define_singleton_method, rb_ext_ractor_safe(), rb_intern(), rsock_init_basicsocket(), rsock_init_socket_init(), rsock_sock_listen(), rsock_sock_s_socketpair, sock_gethostname, and socket_s_ip_address_list.

## ◆ rsock_sock_listen()

VALUE rsock_sock_listen | ( | VALUE | sock,
|  | VALUE | log
| ) |  |

Definition at line 607 of file socket.c.

References rb_io_t::fd, GetOpenFile, INT2FIX, NUM2INT, and rb_sys_fail().

Referenced by Init_socket(), rsock_init_tcpserver(), and rsock_init_unixserver().

## ◆ rsock_sys_fail_host_port()

void rsock_sys_fail_host_port | ( | const char * | mesg,
|  | VALUE | host,
|  | VALUE | port
| ) |  |

Definition at line 18 of file socket.c.

References rsock_syserr_fail_host_port().

## ◆ rsock_sys_fail_path()

void rsock_sys_fail_path | ( | const char * | mesg,
|  | VALUE | path
| ) |  |

Definition at line 35 of file socket.c.

References rsock_syserr_fail_path().

## ◆ rsock_sys_fail_raddrinfo()

void rsock_sys_fail_raddrinfo | ( | const char * | mesg,
|  | VALUE | rai
| ) |  |

Definition at line 71 of file socket.c.

References rsock_syserr_fail_raddrinfo().

## ◆ rsock_sys_fail_raddrinfo_or_sockaddr()

void rsock_sys_fail_raddrinfo_or_sockaddr | ( | const char * | mesg,
|  | VALUE | addr,
|  | VALUE | rai
| ) |  |

Definition at line 88 of file socket.c.

References rsock_syserr_fail_raddrinfo_or_sockaddr().

## ◆ rsock_sys_fail_sockaddr()

void rsock_sys_fail_sockaddr | ( | const char * | mesg,
|  | struct sockaddr * | addr,
|  | socklen_t | len
| ) |  |

Definition at line 55 of file socket.c.

References len, and rsock_syserr_fail_sockaddr().

## ◆ rsock_syserr_fail_host_port()

void rsock_syserr_fail_host_port | ( | int | err,
|  | const char * | mesg,
|  | VALUE | host,
|  | VALUE | port
| ) |  |

Definition at line 24 of file socket.c.

References err, PRIsVALUE, rb_sprintf(), and rb_syserr_fail_str().

Referenced by rsock_sys_fail_host_port().

## ◆ rsock_syserr_fail_path()

void rsock_syserr_fail_path | ( | int | err,
|  | const char * | mesg,
|  | VALUE | path
| ) |  |

Definition at line 41 of file socket.c.

References err, PRIsVALUE, rb_sprintf(), rb_syserr_fail(), rb_syserr_fail_str(), and T_STRING.

Referenced by rsock_sys_fail_path().

## ◆ rsock_syserr_fail_raddrinfo()

void rsock_syserr_fail_raddrinfo | ( | int | err,
|  | const char * | mesg,
|  | VALUE | rai
| ) |  |

Definition at line 77 of file socket.c.

References err, PRIsVALUE, rb_sprintf(), rb_syserr_fail_str(), rsock_addrinfo_inspect_sockaddr(), and str.

Referenced by rsock_sys_fail_raddrinfo(), rsock_syserr_fail_raddrinfo_or_sockaddr(), and rsock_syserr_fail_sockaddr().

## ◆ rsock_syserr_fail_raddrinfo_or_sockaddr()

void rsock_syserr_fail_raddrinfo_or_sockaddr | ( | int | err,
|  | const char * | mesg,
|  | VALUE | addr,
|  | VALUE | rai
| ) |  |

Definition at line 94 of file socket.c.

References err, NIL_P, rsock_syserr_fail_raddrinfo(), rsock_syserr_fail_sockaddr(), RSTRING_LEN, RSTRING_PTR, and StringValue.

Referenced by rsock_sys_fail_raddrinfo_or_sockaddr().

## ◆ rsock_syserr_fail_sockaddr()

void rsock_syserr_fail_sockaddr | ( | int | err,
|  | const char * | mesg,
|  | struct sockaddr * | addr,
|  | socklen_t | len
| ) |  |

Definition at line 61 of file socket.c.

References err, len, PF_UNSPEC, Qnil, rsock_addrinfo_new(), and rsock_syserr_fail_raddrinfo().

Referenced by rsock_sys_fail_sockaddr(), and rsock_syserr_fail_raddrinfo_or_sockaddr().