lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] DHCP


From: address@hidden
Subject: Re: [lwip-users] DHCP
Date: Sat, 24 May 2008 12:49:13 +0200
User-agent: Thunderbird 2.0.0.14 (Macintosh/20080421)


You can get the IP address, Netmask and Gateway from the netif you're using
for the interface: e.g. netif->ip_addr
With this, you are relying on lwIP-internal data structures! While this surely works, it is strongly discouraged by the lwIP developers: The internals data structures are never guaranteed to be portable accross versions so you risk your code being valid for a specific version of lwIP only!

I'm aware this is a problem here, though: there is no function (or macro) netif_get_addr corresponding to your code, which is why Jonathan suggested using nectonn_addr, which leads to the same result if you have one netif only.
If( ( netif->flags & (NETIF_FLAG_UP | NETIF_FLAG_LINK_UP) ) !=
(NETIF_FLAG_UP | NETIF_FLAG_LINK_UP) )
        Check_timer - if expired do something.
Same as above: please don't use the internal structs and its flag definitions when the same can be done differently since you risk using portablilty over lwIP versions:

Since 1.3.0 (which was when NETIF_FALG_LINK_UP was introduced), you can set callback functions to be called when the netif status changes, which event eliminates the use of a timer suggested by bill: netif_set_status_callback.

Simon




reply via email to

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