Home
UV module

GetAddrInfoReq

DNS resolver request to get the IP address of a hostname.

GetAddrInfoReq

#include <icy/request.h>
struct GetAddrInfoReq

Defined in src/base/include/icy/request.h:188

Inherits: Request< uv_getaddrinfo_t, GetAddrInfoEvent >

DNS resolver request to get the IP address of a hostname.

List of all members

NameKindOwner
GetAddrInfoReqfunctionDeclared here
resolvefunctionDeclared here
getAddrInfoCallbackfunctionDeclared here
RequesttypedefDeclared here
reqvariableInherited from Request
callbackvariableInherited from Request
RequestfunctionInherited from Request
invokefunctionInherited from Request
invokefunctionInherited from Request
defaultCallbackfunctionInherited from Request
TypetypedefInherited from Request
EventtypedefInherited from Request

Inherited from Request

KindNameDescription
variablereqThe underlying libuv request object.
variablecallbackCalled when the request completes.
functionRequest inlineConstruct the request and set req.data to this so callbacks can recover the wrapper pointer.
functioninvoke inline -> std::enable_if_t<!std::is_void< std::invoke_result_t< F, Args... > >::value, int >Call f with args. If f returns a non-zero libuv error code, the callback is invoked immediately with that status.
functioninvoke inline -> std::enable_if_t< std::is_void< std::invoke_result_t< F, Args... > >::value >Call f with args. Overload for void-returning functions; no error checking is performed.
functiondefaultCallback static inlineStandard libuv completion callback. Invokes callback with the status event and then deletes the [Request](icy-uv-Request.html#request-2) wrapper.
typedefType
typedefEvent

Public Methods

ReturnNameDescription
GetAddrInfoReq inlineConstruct and set req.data to this.
autoresolve inlineBegin asynchronous DNS resolution of host at port.

GetAddrInfoReq

inline

inline GetAddrInfoReq()

Defined in src/base/include/icy/request.h:193

Construct and set req.data to this.


resolve

inline

inline auto resolve(const std::string & host, int port, uv::Loop * loop = uv::defaultLoop())

Defined in src/base/include/icy/request.h:225

Begin asynchronous DNS resolution of host at port.

The result is delivered to callback as a [GetAddrInfoEvent](icy-uv-GetAddrInfoEvent.html#getaddrinfoevent). The addrinfo pointer in the event is freed immediately after the callback returns; do not retain it.

Parameters

  • host Hostname or numeric IP address string to resolve.

  • port Port number; converted to a service string for getaddrinfo.

  • loop Event loop on which to run the resolution.

Returns

true if the request was submitted successfully.

Public Static Methods

ReturnNameDescription
voidgetAddrInfoCallback static inlinelibuv completion callback for uv_getaddrinfo.

getAddrInfoCallback

static inline

static inline void getAddrInfoCallback(Request::Type * req, int status, struct addrinfo * res)

Defined in src/base/include/icy/request.h:206

libuv completion callback for uv_getaddrinfo.

Invokes the stored callback with the resolved address list, then frees the addrinfo chain and deletes the wrapper.

Parameters

  • req The completed uv_getaddrinfo_t request.

  • status libuv status code.

  • res Resolved address list (freed after callback returns).

Public Types

NameDescription
Request

Request

using Request = uv::Request< uv_getaddrinfo_t, GetAddrInfoEvent >

Defined in src/base/include/icy/request.h:190