#include "uv.h"
#include "internal.h"
#include "idna.h"
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <net/if.h>
#include <netdb.h>
Go to the source code of this file.
|
int | uv__getaddrinfo_translate_error (int sys_err) |
|
static void | uv__getaddrinfo_work (struct uv__work *w) |
|
static void | uv__getaddrinfo_done (struct uv__work *w, int status) |
|
int | uv_getaddrinfo (uv_loop_t *loop, uv_getaddrinfo_t *req, uv_getaddrinfo_cb cb, const char *hostname, const char *service, const struct addrinfo *hints) |
|
void | uv_freeaddrinfo (struct addrinfo *ai) |
|
int | uv_if_indextoname (unsigned int ifindex, char *buffer, size_t *size) |
|
int | uv_if_indextoiid (unsigned int ifindex, char *buffer, size_t *size) |
|
◆ _GNU_SOURCE
◆ uv__getaddrinfo_done()
static void uv__getaddrinfo_done |
( |
struct uv__work * |
w, |
|
|
int |
status |
|
) |
| |
|
static |
Definition at line 111 of file getaddrinfo.c.
120 else if (
req->service)
122 else if (
req->hostname)
131 if (
status == UV_ECANCELED) {
133 req->retcode = UV_EAI_CANCELED;
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec req
static const char struct stat static buf struct stat static buf static vhangup int status
assert(limit<=UINT32_MAX/2)
#define container_of(ptr, type, member)
#define uv__req_unregister(loop, req)
References assert(), container_of, NULL, req, status, uv__free(), uv__req_unregister, and w.
Referenced by uv_getaddrinfo().
◆ uv__getaddrinfo_translate_error()
int uv__getaddrinfo_translate_error |
( |
int |
sys_err | ) |
|
Definition at line 42 of file getaddrinfo.c.
45 #if defined(EAI_ADDRFAMILY)
46 case EAI_ADDRFAMILY:
return UV_EAI_ADDRFAMILY;
48 #if defined(EAI_AGAIN)
49 case EAI_AGAIN:
return UV_EAI_AGAIN;
51 #if defined(EAI_BADFLAGS)
52 case EAI_BADFLAGS:
return UV_EAI_BADFLAGS;
54 #if defined(EAI_BADHINTS)
55 case EAI_BADHINTS:
return UV_EAI_BADHINTS;
57 #if defined(EAI_CANCELED)
58 case EAI_CANCELED:
return UV_EAI_CANCELED;
61 case EAI_FAIL:
return UV_EAI_FAIL;
63 #if defined(EAI_FAMILY)
64 case EAI_FAMILY:
return UV_EAI_FAMILY;
66 #if defined(EAI_MEMORY)
67 case EAI_MEMORY:
return UV_EAI_MEMORY;
69 #if defined(EAI_NODATA)
70 case EAI_NODATA:
return UV_EAI_NODATA;
72 #if defined(EAI_NONAME)
73 # if !defined(EAI_NODATA) || EAI_NODATA != EAI_NONAME
74 case EAI_NONAME:
return UV_EAI_NONAME;
77 #if defined(EAI_OVERFLOW)
78 case EAI_OVERFLOW:
return UV_EAI_OVERFLOW;
80 #if defined(EAI_PROTOCOL)
81 case EAI_PROTOCOL:
return UV_EAI_PROTOCOL;
83 #if defined(EAI_SERVICE)
84 case EAI_SERVICE:
return UV_EAI_SERVICE;
86 #if defined(EAI_SOCKTYPE)
87 case EAI_SOCKTYPE:
return UV_EAI_SOCKTYPE;
89 #if defined(EAI_SYSTEM)
90 case EAI_SYSTEM:
return UV__ERR(errno);
93 assert(!
"unknown EAI_* error code");
References assert(), and UV__ERR.
Referenced by uv__getaddrinfo_work(), and uv__getnameinfo_work().
◆ uv__getaddrinfo_work()
static void uv__getaddrinfo_work |
( |
struct uv__work * |
w | ) |
|
|
static |
◆ uv_freeaddrinfo()
void uv_freeaddrinfo |
( |
struct addrinfo * |
ai | ) |
|
◆ uv_getaddrinfo()
Definition at line 141 of file getaddrinfo.c.
147 char hostname_ascii[256];
162 (void) &hostname_ascii;
164 if (hostname !=
NULL) {
166 hostname + strlen(hostname),
168 hostname_ascii +
sizeof(hostname_ascii));
171 hostname = hostname_ascii;
175 hostname_len = hostname ? strlen(hostname) + 1 : 0;
176 service_len = service ? strlen(service) + 1 : 0;
177 hints_len = hints ?
sizeof(*hints) : 0;
197 len +=
sizeof(*hints);
long uv__idna_toascii(const char *s, const char *se, char *d, char *de)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void uv__work_submit(uv_loop_t *loop, struct uv__work *w, enum uv__work_kind kind, void(*work)(struct uv__work *w), void(*done)(struct uv__work *w, int status))
static void uv__getaddrinfo_work(struct uv__work *w)
static void uv__getaddrinfo_done(struct uv__work *w, int status)
void * uv__malloc(size_t size)
#define uv__req_init(loop, req, typ)
◆ uv_if_indextoiid()
Definition at line 253 of file getaddrinfo.c.
int uv_if_indextoname(unsigned int ifindex, char *buffer, size_t *size)
◆ uv_if_indextoname()