libnx
sfdnsres.h
Go to the documentation of this file.
1 /**
2  * @file sfdnsres.h
3  * @brief Domain name resolution service IPC wrapper. Please use socket.c instead.
4  * @author TuxSH
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 
10 #include <sys/socket.h> // For socklen_t, etc.
11 
12 /// Configuration structure for sfdnsres.
13 typedef struct {
14  size_t serialized_out_addrinfos_max_size; ///< For getaddrinfo.
15  size_t serialized_out_hostent_max_size; ///< For gethostbyname/gethostbyaddr.
16  bool bypass_nsd; ///< For name gethostbyname/getaddrinfo: bypass the Name Server Daemon.
17  int timeout; ///< For DNS requests: timeout or 0.
19 
20 /// Result values returned by the DNS request commands.
21 typedef struct {
22  int ret; ///< Return value (error code).
23  int errno_; ///< Errno.
24  ssize_t out_serialized_size; ///< Size of the serialized output buffer or -1 (?).
26 
27 // SetDnsAddressesPrivate & GetDnsAddressPrivate are stubbed
28 
29 Result sfdnsresGetHostByName(SfdnsresRequestResults *ret, const SfdnsresConfig *config, void *out_he_serialized, const char *name);
30 Result sfdnsresGetHostByAddr(SfdnsresRequestResults *ret, const SfdnsresConfig *config, void *out_he_serialized, const void *addr, socklen_t len, int type);
31 
32 Result sfdnsresGetHostStringError(int err, char *str, size_t str_size);
33 Result sfdnsresGetGaiStringError(int err, char *str, size_t str_size);
34 
35 Result sfdnsresGetAddrInfo(SfdnsresRequestResults *ret, const SfdnsresConfig *config, const char *node, const char *service,
36  const void *hints_serialized, size_t hints_serialized_size, void *res_serialized);
37 Result sfdnsresGetNameInfo(SfdnsresRequestResults *ret, const SfdnsresConfig *config,
38  const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen,
39  char *serv, size_t servlen, int flags);
40 
41 /// Requests an handle for use with @ref sfdnsresCancelSocketCall.
43 /// Cancels a DNS request (how? which requests?). Bug: always sets errno?
45 /// Cancels all DNS requests made by the current process (how? which requests?). Bug: always sets errno?
47 /// Clears up to 4 DNS server IPs registered by bsdcfg (DHCP client, etc.).
bool bypass_nsd
For name gethostbyname/getaddrinfo: bypass the Name Server Daemon.
Definition: sfdnsres.h:16
int ret
Return value (error code).
Definition: sfdnsres.h:22
u32 Result
Function error code result type.
Definition: types.h:46
size_t serialized_out_addrinfos_max_size
For getaddrinfo.
Definition: sfdnsres.h:14
uint32_t u32
32-bit unsigned integer.
Definition: types.h:23
int errno_
Errno.
Definition: sfdnsres.h:23
Result sfdnsresCancelAllSocketCalls(SfdnsresRequestResults *ret)
Cancels all DNS requests made by the current process (how? which requests?). Bug: always sets errno...
int timeout
For DNS requests: timeout or 0.
Definition: sfdnsres.h:17
Result sfdnsresCancelSocketCall(SfdnsresRequestResults *ret, u32 handle)
Cancels a DNS request (how? which requests?). Bug: always sets errno?
size_t serialized_out_hostent_max_size
For gethostbyname/gethostbyaddr.
Definition: sfdnsres.h:15
Configuration structure for sfdnsres.
Definition: sfdnsres.h:13
Result sfdnsresRequestCancelHandle(u32 *out_handle)
Requests an handle for use with sfdnsresCancelSocketCall.
ssize_t out_serialized_size
Size of the serialized output buffer or -1 (?).
Definition: sfdnsres.h:24
Result values returned by the DNS request commands.
Definition: sfdnsres.h:21
Result sfdnsresClearDnsIpServerAddressArray(void)
Clears up to 4 DNS server IPs registered by bsdcfg (DHCP client, etc.).