lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] DNS client for lwIP raw API


From: Winformatik Info
Subject: Re: [lwip-users] DNS client for lwIP raw API
Date: Fri, 13 Jul 2007 17:09:27 +0200
User-agent: Thunderbird 2.0.0.4 (Windows/20070604)

Hi Jim,

I have tested the resolver code from you. It is working great... after a little debugging. I always had the problem if the domain name to resolve had an odd number of bytes. If this was the case, the resolver did not work (I use a 16-bit CPU with an alignment of 2). To solve the problem I think we should surround the struct "s_dns_answer" by the two macros PACK_STRUCT_BEGIN and PACK_STRUCT_END (please see below). This handles a mapping of the struct "s_dns_answer" starting on an odd address the right way.

/* The DNS answer message structure */
PACK_STRUCT_BEGIN
typedef struct s_dns_answer {
 /* DNS answer record starts with either a domain name or a pointer
 to a name already present somewhere in the packet. */
 u16_t type;
 u16_t class;
 u16_t ttl[2];
 u16_t len;
 struct ip_addr ipaddr;
} DNS_ANSWER;
PACK_STRUCT_END

Hope this also helps others...

Roland


Pettinato, Jim schrieb:
You're welcome... Hopefully more sweet stuff to follow. ;)

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf
Of Taranowski, Thomas (SWCOE)
Sent: Wednesday, June 27, 2007 2:31 PM
To: Mailing list for lwIP users
Subject: RE: [lwip-users] DNS client for lwIP raw API


This is sweet.  I've been wanting some DNS functionality for awhile.
Thanks.

-----Original Message-----
From: address@hidden
[mailto:address@hidden
On
Behalf Of Pettinato, Jim
Sent: Tuesday, June 19, 2007 5:30 AM
To: Mailing list for lwIP users
Subject: [lwip-users] DNS client for lwIP raw API


All:

As mentioned here before, I have ported Adam Dunkel's original uIP DNS

client (resolv.c) to something that works for raw API apps. There has been some interest expressed recently in this code by others, and
since
I don't want to keep everyone who might benefit waiting until we
decide
whether to integrate this into the core or maintain it as a separate application, I have attached the module here.

In the nature of the raw API, this DNS client has been implemented
using
the callback scheme - there is a gethostbyname() function that accepts
a
callback argument that is stored away if a query is required for the requested host, and then is called when the DNS query completes or
times
out. See the header file for more details.

The only requirements to use it (other than including the module in
the
build and calling gethostbyname() with an appropriate callback
function)
is to call resolv_init() with an appropriate DNS server IP address,
and
adding a call to the resolve_tmr() function approximately once a
second
in your timer routine.

Let me know if you 1. can't access the attachment and 2. need this
code
immediately; and I'll post it as inline text or forward it to your specific email address.

- Jim

__


James M. Pettinato, Jr.
Software Engineer
E: address@hidden | P: 814 898 5250

FMC Technologies Measurement Solutions Inc.
1602 Wagner Avenue | Erie PA | 16510 USA
Phone: 814 898 5000 | Fax: 814 899-3414 www.fmctechnologies.com


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users






reply via email to

[Prev in Thread] Current Thread [Next in Thread]