#include <dolphin/ip.h>
typedef struct DNSHeader
{
u16 id;
u16 flags;
u16 qdcount;
u16 ancount;
u16 nscount;
u16 arcount;
} DNSHeader;
typedef void (* DNSCallback )(DNSInfo* info, s32 result);
s32 DNSLookupAsync( DNSInfo* info,
const u8* query, s32 queryLen, u8* response, s32 responseLen,
DNSCallback callback, s32* result );
s32 DNSLookup ( DNSInfo* info,
const u8* query, s32 queryLen, u8* response, s32 responseLen );
DNSLookupAsync() sends a query in the raw DNS format to the
name server and receives the response also in the raw DNS format. Please refer
to RFC 1035 for the DNS format
detail.
info |
Pointer to DNSInfo to perform query. |
query |
DNS query message. |
queryLen |
The size of DNS query message which begins with DNSHeader
in bytes. |
response |
Buffer to receive the DNS response message. |
responseLen |
Size of the response buffer in bytes. |
callback |
Notified when the query is resolved. |
result |
Optional pointer to s32 that receives the function result.
While the operation is in progress, the value *result
is set to IP_ERR_BUSY. |
IP_ERR_NONE |
Succeeded. |
IP_ERR_INVALID |
Specified parameters are invalid. |
IP_ERR_BUSY |
Specified info is busy. |
IP_ERR_UNREACHABLE |
Specified DNS server is unreachable from this machine. |
IP_ERR_DATASIZE |
The data size exceeds the transfer limit. |
IP_ERR_INS_RESOURCES |
Failed to allocate an ephemeral source port number. |
IP_ERR_TIMEOUT |
Timeout error. |
IP_ERR_DNS_FORMAT |
Format error - The name server was unable to interpret the query. |
IP_ERR_DNS_SERVER |
Server failure - The name server was unable to process the query due to a problem with the name server. |
IP_ERR_DNS_NAME |
Name Error - The domain name referenced in the query does not exist. |
IP_ERR_DNS_NOTIMP |
Not Implemented - The name server does not support the requested kind of query. |
IP_ERR_DNS_REFUSED |
Refused - The name server refuses to perform the specified operation for policy reasons. |
IP_ERR_NETDOWN |
Local network interface is down. |
Note: The specified callback
is not called when the return value of the function is less than zero.
| zero or greater | Query succeeded. The number of received bytes. |
Mockapetris, P., 1987 "Domain Names - Implementation and Specification", RFC 1035 (Nov.).