otp_net.c
Include dependency graph for otp_net.c:
Defines
-
UNKNOWN_TABLE_VALUE -1
Functions
-
static term eai_errno_to_term(int err, GlobalContext *glb)
-
static term make_getaddrinfo_result(term *keys, int ai_protocol, int ai_socktype, term inner_addr, GlobalContext *global, Heap *heap)
Make a getaddrino result item as part of the iteration.
This function is called in a loop to create optimized maps that share keys. @end
- Parameters:
keys – pointer to a term to store the keys of the map. If it’s invalid_term, a non-shared map will be created and the keys term will be updated. Otherwise, it’s used to create a shared map
ai_protocol – protocol field of the addrinfo
ai_socktype – socktype field of the addrinfo
inner_addr – IP address that will be stored in both address and addr entries of the map
global – the global context
heap – the heap to create terms in, should have sufficient free space
- Returns:
the getaddrinfo result item term
-
void otp_net_init(GlobalContext *global)
Variables
- static const AtomStringIntPair protocol_table [] = {{ATOM_STR("\x3", "tcp"), IPPROTO_TCP },{ATOM_STR("\x3", "udp"), IPPROTO_UDP },}
- static const AtomStringIntPair type_table [] = {{ATOM_STR("\x5", "dgram"), SOCK_DGRAM },{ATOM_STR("\x6", "stream"), SOCK_STREAM },}
-
static const struct Nif net_getaddrinfo_nif = {.base.type = NIFFunctionType, .nif_ptr = nif_net_getaddrinfo}