mbed OS5

Fork of UIPEthernet by Zoltan Hudak

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Dns.h Source File

Dns.h

00001 // Arduino DNS client for Enc28J60-based Ethernet shield
00002 // (c) Copyright 2009-2010 MCQN Ltd.
00003 // Released under Apache License, version 2.0
00004 #ifndef DNSClient_h
00005 #define DNSClient_h
00006 
00007 #include "UIPUdp.h"
00008 
00009 class   DNSClient
00010 {
00011 public:
00012     // ctor
00013     void    begin(const IPAddress& aDNSServer);
00014 
00015     /** Convert a numeric IP address string into a four-byte IP address.
00016         @param aIPAddrString IP address to convert
00017         @param aResult IPAddress structure to store the returned IP address
00018         @result 1 if aIPAddrString was successfully converted to an IP address,
00019                 else error code
00020     */
00021     int     inet_aton(const char* aIPAddrString, IPAddress& aResult);
00022 
00023     /** Resolve the given hostname to an IP address.
00024         @param aHostname Name to be resolved
00025         @param aResult IPAddress structure to store the returned IP address
00026         @result 1 if aIPAddrString was successfully converted to an IP address,
00027                 else error code
00028     */
00029     int     getHostByName(const char* aHostname, IPAddress& aResult);
00030 protected:
00031     uint16_t    BuildRequest(const char* aName);
00032     uint16_t    ProcessResponse(uint16_t aTimeout, IPAddress& aAddress);
00033 
00034     IPAddress   iDNSServer;
00035     uint16_t    iRequestId;
00036     UIPUDP      iUdp;
00037 };
00038 #endif