RF24Ethernet - TCP/IP over RF24Network v1.6.15
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 void begin(const IPAddress& aDNSServer);
16
17 /**
18 * Convert a numeric IP address string into a four-byte IP address.
19 * @param aIPAddrString IP address to convert
20 * @param aResult IPAddress structure to store the returned IP address
21 * @result 1 if aIPAddrString was successfully converted to an IP address,
22 * else error code
23 */
24 int inet_aton(const char* aIPAddrString, IPAddress& aResult);
25
26 /**
27 * Resolve the given hostname to an IP address.
28 * @param aHostname Name to be resolved
29 * @param aResult IPAddress structure to store the returned IP address
30 * @result 1 if aIPAddrString was successfully converted to an IP address,
31 * else error code
32 */
33 int getHostByName(const char* aHostname, IPAddress& aResult);
34
35protected:
36 uint16_t BuildRequest(const char* aName);
37 uint16_t ProcessResponse(uint16_t aTimeout, IPAddress& aAddress);
38
39 IPAddress iDNSServer;
40 uint16_t iRequestId;
41 RF24UDP iUdp;
42};
43
44#endif
45#endif