Project

General

Profile

Statistics
| Branch: | Revision:

root / arduino-1.0 / libraries / Ethernet / Dns.h @ 58d82c77

History | View | Annotate | Download (1.26 KB)

1 58d82c77 Tom Mullins
// Arduino DNS client for WizNet5100-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 <EthernetUdp.h>
9
10
class DNSClient
11
{
12
public:
13
    // ctor
14
    void begin(const IPAddress& aDNSServer);
15
16
    /** Convert a numeric IP address string into a four-byte IP address.
17
        @param aIPAddrString IP address to convert
18
        @param aResult IPAddress structure to store the returned IP address
19
        @result 1 if aIPAddrString was successfully converted to an IP address,
20
                else error code
21
    */
22
    int inet_aton(const char *aIPAddrString, IPAddress& aResult);
23
24
    /** Resolve the given hostname to an IP address.
25
        @param aHostname Name to be resolved
26
        @param aResult IPAddress structure to store the returned IP address
27
        @result 1 if aIPAddrString was successfully converted to an IP address,
28
                else error code
29
    */
30
    int getHostByName(const char* aHostname, IPAddress& aResult);
31
32
protected:
33
    uint16_t BuildRequest(const char* aName);
34
    uint16_t ProcessResponse(uint16_t aTimeout, IPAddress& aAddress);
35
36
    IPAddress iDNSServer;
37
    uint16_t iRequestId;
38
    EthernetUDP iUdp;
39
};
40
41
#endif