sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
dns.h
Go to the documentation of this file.
1
6
39
40#ifndef LWIP_HDR_DNS_H
41#define LWIP_HDR_DNS_H
42
43#include "lwip/opt.h"
44
45#if LWIP_DNS
46
47#include "lwip/ip_addr.h"
48#include "lwip/err.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
55#define DNS_TMR_INTERVAL 1000
56
57/* DNS resolve types: */
58#define LWIP_DNS_ADDRTYPE_IPV4 0
59#define LWIP_DNS_ADDRTYPE_IPV6 1
60#define LWIP_DNS_ADDRTYPE_IPV4_IPV6 2 /* try to resolve IPv4 first, try IPv6 if IPv4 fails only */
61#define LWIP_DNS_ADDRTYPE_IPV6_IPV4 3 /* try to resolve IPv6 first, try IPv4 if IPv6 fails only */
62#if LWIP_IPV4 && LWIP_IPV6
63#ifndef LWIP_DNS_ADDRTYPE_DEFAULT
64#define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV4_IPV6
65#endif
66#elif LWIP_IPV4
67#define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV4
68#else
69#define LWIP_DNS_ADDRTYPE_DEFAULT LWIP_DNS_ADDRTYPE_IPV6
70#endif
71
72#if DNS_LOCAL_HOSTLIST
74struct local_hostlist_entry {
76 const char *name;
78 ip_addr_t addr;
79 struct local_hostlist_entry *next;
80};
81#define DNS_LOCAL_HOSTLIST_ELEM(name, addr_init) {name, addr_init, NULL}
82#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC
83#ifndef DNS_LOCAL_HOSTLIST_MAX_NAMELEN
84#define DNS_LOCAL_HOSTLIST_MAX_NAMELEN DNS_MAX_NAME_LENGTH
85#endif
86#define LOCALHOSTLIST_ELEM_SIZE ((sizeof(struct local_hostlist_entry) + DNS_LOCAL_HOSTLIST_MAX_NAMELEN + 1))
87#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
88#endif /* DNS_LOCAL_HOSTLIST */
89
90#if LWIP_IPV4
91extern const ip_addr_t dns_mquery_v4group;
92#endif /* LWIP_IPV4 */
93#if LWIP_IPV6
94extern const ip_addr_t dns_mquery_v6group;
95#endif /* LWIP_IPV6 */
96
104typedef void (*dns_found_callback)(const char *name, const ip_addr_t *ipaddr, void *callback_arg);
105
106void dns_init(void);
107void dns_tmr(void);
108void dns_setserver(u8_t numdns, const ip_addr_t *dnsserver);
109const ip_addr_t* dns_getserver(u8_t numdns);
110err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr,
111 dns_found_callback found, void *callback_arg);
112err_t dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr,
113 dns_found_callback found, void *callback_arg,
114 u8_t dns_addrtype);
115
116
117#if DNS_LOCAL_HOSTLIST
118size_t dns_local_iterate(dns_found_callback iterator_fn, void *iterator_arg);
119err_t dns_local_lookup(const char *hostname, ip_addr_t *addr, u8_t dns_addrtype);
120#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC
121int dns_local_removehost(const char *hostname, const ip_addr_t *addr);
122err_t dns_local_addhost(const char *hostname, const ip_addr_t *addr);
123#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
124#endif /* DNS_LOCAL_HOSTLIST */
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif /* LWIP_DNS */
131
132#endif /* LWIP_HDR_DNS_H */
void(*) dns_found_callback(const char *name, const ip_addr_t *ipaddr, void *callback_arg)
Definition tcpip.h:1901