RF24Ethernet - TCP/IP over RF24Network v1.6.12
TMRh20 - Pushing the practical limits of RF24 modules
Loading...
Searching...
No Matches
Dns.h
Go to the documentation of this file.
1// Arduino DNS client for Enc28J60-based Ethernet shield
2// (c) Copyright 2009-2010 MCQN Ltd.
3// Released under Apache License, version 2.0
4
5#ifndef DNSClient_h
6#define DNSClient_h
7
8#include "RF24Ethernet.h"
9
10#if UIP_CONF_UDP > 0
11
12class DNSClient
13{
14public:
15
16 void begin(const IPAddress& aDNSServer);
17
18 /**
19 * Convert a numeric IP address string into a four-byte IP address.
20 * @param aIPAddrString IP address to convert
21 * @param aResult IPAddress structure to store the returned IP address
22 * @result 1 if aIPAddrString was successfully converted to an IP address,
23 * else error code
24 */
25 int inet_aton(const char *aIPAddrString, IPAddress& aResult);
26
27 /**
28 * Resolve the given hostname to an IP address.
29 * @param aHostname Name to be resolved
30 * @param aResult IPAddress structure to store the returned IP address
31 * @result 1 if aIPAddrString was successfully converted to an IP address,
32 * else error code
33 */
34 int getHostByName(const char* aHostname, IPAddress& aResult);
35
36protected:
37 uint16_t BuildRequest(const char* aName);
38 uint16_t ProcessResponse(uint16_t aTimeout, IPAddress& aAddress);
39
40 IPAddress iDNSServer;
41 uint16_t iRequestId;
42 RF24UDP iUdp;
43};
44
45#endif
46#endif