Dependents: SimpleLCDClock readCard2Twitter_http AnalogClock_StepperMotor_NTP ServoCamV1
Diff: if/lwip/lwipNetDnsRequest.h
- Revision:
- 0:3717b703f76d
- Child:
- 1:e52ec2a24c6a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/if/lwip/lwipNetDnsRequest.h Mon May 24 10:23:42 2010 +0000 @@ -0,0 +1,40 @@ +#ifndef LWIPNETDNSREQUEST_H +#define LWIPNETDNSREQUEST_H + +#define NET_LWIP_STACK 1 +#include "if/net/netdnsrequest.h" + +//struct ip_addr_t; +#include "lwip/ip_addr.h" + +class LwipNetDnsRequest : public NetDnsRequest +{ +public: + LwipNetDnsRequest(const char* hostname); + LwipNetDnsRequest(Host* pHost); + virtual ~LwipNetDnsRequest(); + + //Execute request & return OK if found, NOTFOUND or ERROR on error, or PROCESSING if the request has not completed yet + virtual void poll(); + +protected: + void foundCb(const char *name, ip_addr_t *ipaddr); + +private: + enum LwipNetDnsState + { + LWIPNETDNS_START, + LWIPNETDNS_PROCESSING, //Req has not completed + LWIPNETDNS_NOTFOUND, + LWIPNETDNS_ERROR, + LWIPNETDNS_OK + }; + + LwipNetDnsState m_state; + bool m_cbFired; + + //Static callbacks : Transforms into a C++ callback + static void sFoundCb(const char *name, ip_addr_t *ipaddr, void *arg); +}; + +#endif