Ruby: ext/socket/sockport.h File Reference

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

Macros
sockport.h File Reference

Go to the source code of this file.

## Macros
#define | VALIDATE_SOCKLEN(addr, len) ((void)(addr), (void)(len), 1)
#define | SET_SA_LEN(sa, len) (void)(len)
#define | SET_SIN_LEN(sa, len) SET_SA_LEN((struct sockaddr *)(sa), (len))
#define | SET_SIN6_LEN(sa, len) SET_SA_LEN((struct sockaddr *)(sa), (len))
#define | INIT_SOCKADDR(addr, family, len)
#define | INIT_SOCKADDR_IN(addr, len)
#define | INIT_SOCKADDR_IN6(addr, len)
#define | IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
#define | IN_MULTICAST(i) IN_CLASSD(i)
#define | IN_EXPERIMENTAL(i) ((((long)(i)) & 0xe0000000) == 0xe0000000)
#define | IN_CLASSA_NSHIFT 24
#define | IN_LOOPBACKNET 127
#define | AF_UNSPEC 0
#define | PF_UNSPEC AF_UNSPEC
#define | PF_INET AF_INET

## Macro Definition Documentation

## ◆ AF_UNSPEC

#define AF_UNSPEC 0

Definition at line 101 of file sockport.h.

## ◆ IN_CLASSA_NSHIFT

#define IN_CLASSA_NSHIFT 24

Definition at line 93 of file sockport.h.

## ◆ IN_CLASSD

#define IN_CLASSD | ( |  | i | ) | (((long)(i) & 0xf0000000) == 0xe0000000)

Definition at line 84 of file sockport.h.

## ◆ IN_EXPERIMENTAL

#define IN_EXPERIMENTAL | ( |  | i | ) | ((((long)(i)) & 0xe0000000) == 0xe0000000)

Definition at line 89 of file sockport.h.

## ◆ IN_LOOPBACKNET

#define IN_LOOPBACKNET 127

Definition at line 97 of file sockport.h.

## ◆ IN_MULTICAST

#define IN_MULTICAST | ( |  | i | ) | IN_CLASSD(i)

Definition at line 85 of file sockport.h.

## ◆ INIT_SOCKADDR

#define INIT_SOCKADDR | ( |  | addr,
|  |  | family,
|  |  | len
| ) |  |

Value:
do { \
struct sockaddr *init_sockaddr_ptr = (addr); \
socklen_t init_sockaddr_len = (len); \
memset(init_sockaddr_ptr, 0, init_sockaddr_len); \
init_sockaddr_ptr->sa_family = (family); \
SET_SA_LEN(init_sockaddr_ptr, init_sockaddr_len); \
} while (0)
len
uint8_t len
Definition: escape.c:17
socklen_t
int socklen_t
Definition: getaddrinfo.c:83

Definition at line 38 of file sockport.h.

## ◆ INIT_SOCKADDR_IN

#define INIT_SOCKADDR_IN | ( |  | addr,
|  |  | len
| ) |  |

Value:
do { \
struct sockaddr_in *init_sockaddr_ptr = (addr); \
socklen_t init_sockaddr_len = (len); \
memset(init_sockaddr_ptr, 0, init_sockaddr_len); \
init_sockaddr_ptr->sin_family = AF_INET; \
SET_SIN_LEN(init_sockaddr_ptr, init_sockaddr_len); \
} while (0)

Definition at line 47 of file sockport.h.

## ◆ INIT_SOCKADDR_IN6

#define INIT_SOCKADDR_IN6 | ( |  | addr,
|  |  | len
| ) |  |

Value:
do { \
struct sockaddr_in6 *init_sockaddr_ptr = (addr); \
socklen_t init_sockaddr_len = (len); \
memset(init_sockaddr_ptr, 0, init_sockaddr_len); \
init_sockaddr_ptr->sin6_family = AF_INET6; \
SET_SIN6_LEN(init_sockaddr_ptr, init_sockaddr_len); \
} while (0)

Definition at line 56 of file sockport.h.

## ◆ PF_INET

#define PF_INET AF_INET

Definition at line 109 of file sockport.h.

## ◆ PF_UNSPEC

#define PF_UNSPEC AF_UNSPEC

Definition at line 105 of file sockport.h.

## ◆ SET_SA_LEN

#define SET_SA_LEN | ( |  | sa,
|  |  | len
| ) |  | (void)(len)

Definition at line 22 of file sockport.h.

## ◆ SET_SIN6_LEN

#define SET_SIN6_LEN | ( |  | sa,
|  |  | len
| ) |  | SET_SA_LEN((struct sockaddr *)(sa), (len))

Definition at line 35 of file sockport.h.

## ◆ SET_SIN_LEN

#define SET_SIN_LEN | ( |  | sa,
|  |  | len
| ) |  | SET_SA_LEN((struct sockaddr *)(sa), (len))

Definition at line 29 of file sockport.h.

## ◆ VALIDATE_SOCKLEN

#define VALIDATE_SOCKLEN | ( |  | addr,
|  |  | len
| ) |  | ((void)(addr), (void)(len), 1)

Definition at line 16 of file sockport.h.