UV module
GetAddrInfoReq
DNS resolver request to get the IP address of a hostname.
#include <icy/request.h>
struct GetAddrInfoReqDefined in src/base/include/icy/request.h:188
List of all members
| Name | Kind | Owner |
|---|---|---|
GetAddrInfoReq | function | Declared here |
resolve | function | Declared here |
getAddrInfoCallback | function | Declared here |
Request | typedef | Declared here |
req | variable | Inherited from Request |
callback | variable | Inherited from Request |
Request | function | Inherited from Request |
invoke | function | Inherited from Request |
invoke | function | Inherited from Request |
defaultCallback | function | Inherited from Request |
Type | typedef | Inherited from Request |
Event | typedef | Inherited from Request |
Inherited from Request
| Kind | Name | Description |
|---|---|---|
variable | req | The underlying libuv request object. |
variable | callback | Called when the request completes. |
function | Request inline | Construct the request and set req.data to this so callbacks can recover the wrapper pointer. |
function | invoke 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. |
function | invoke 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. |
function | defaultCallback static inline | Standard libuv completion callback. Invokes callback with the status event and then deletes the Request wrapper. |
typedef | Type | |
typedef | Event |
Public Methods
| Return | Name | Description |
|---|---|---|
GetAddrInfoReq inline | Construct and set req.data to this. | |
auto | resolve inline | Begin 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. The addrinfo pointer in the event is freed immediately after the callback returns; do not retain it.
Returns
true if the request was submitted successfully.
Parameters
| Parameter | Type | Description |
|---|---|---|
host | const std::string & | Hostname or numeric IP address string to resolve. |
port | int | Port number; converted to a service string for getaddrinfo. |
loop | uv::Loop * | Event loop on which to run the resolution. |
Public Static Methods
| Return | Name | Description |
|---|---|---|
void | getAddrInfoCallback static inline | libuv 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
| Parameter | Type | Description |
|---|---|---|
req | Request::Type * | The completed uv_getaddrinfo_t request. |
status | int | libuv status code. |
res | struct addrinfo * | Resolved address list (freed after callback returns). |
Public Types
| Name | Description |
|---|---|
Request |
Request
using Request = uv::Request< uv_getaddrinfo_t, GetAddrInfoEvent >Type: uv::Request< uv_getaddrinfo_t, GetAddrInfoEvent >
