HELP, PLease! DCHP Client

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

HELP, PLease! DCHP Client

Robson-4
Hi,

I´m using LWIP with an ARM Microcontroler in a specific application,
and I want to use this in my common network. So, I want to establish a
DHCP client. But I don´t know how to set DCHP and how to call the
correct functions.

My question is: in a simple application, what is the configurations
and the exactly sequence of call functions should we use?

I try to use dchp_start(), dchp_discover()…but no results.

Please, help more urgent than possible!

If anyone knows how to do this, please, help me! Write for my email
[hidden email] or to this email list.

Thanks

Robson Paulo

_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE: HELP, PLease! DCHP Client

Robert Brown
This is how I did it in lwip 0.6.4.  It might be different in the latest
version.

In lwipopts.h you must set your DHCP options:

#define LWIP_DHCP             1  /* Enable DHCP  */
#define DHCP_DOES_ARP_CHECK   0  /* Set this to 1 if you want dhcp to do an
arp check on the offered address  */
#define DHCP_OPTIONS_LEN      68 /* Space allocated for options in DHCP
messages */


In your initialization routine you must call the usual lwIP init functions:
sys_init();
mem_init();
memp_init();
pbuf_init();
netif_init();
ip_init();

If you are using udp and tcp then call
udp_init();
tcp_init();

Add your network interfaces...
Set ip.addr = 0, gw.addr = 0 and netmask.addr = 0 before you call
netif = netif_add(&ip, &netmask, &gw, ...)


To start the dhcp client on a network interface call
dhcp_start(netif);
and then set the NETIF_FLAG_DHCP flag in your netif.
netif->flags &= NETIF_FLAG_DHCP;

and then call
dhcp_fine_tmr(); every 500ms
dhcp_coarse_tmr(); every 60 sec

To stop the dhcp client call
dhcp_stop(netif);
and unset the NETIF_FLAG_DHCP flag in your netif.
netif->flags |= NETIF_FLAG_DHCP;
stop calling dhcp_fine_tmr() and dhcp_coarse_tmr().

I think that's it.  Good luck.

Cheers,
Rob Brown

-----Original Message-----
From: lwip-users-bounces+robw_brown=[hidden email]
[mailto:lwip-users-bounces+robw_brown=[hidden email]]On Behalf
Of Robson
Sent: November 1, 2005 7:48 AM
To: [hidden email]
Subject: [lwip-users] HELP, PLease! DCHP Client


Hi,

I?m using LWIP with an ARM Microcontroler in a specific application,
and I want to use this in my common network. So, I want to establish a
DHCP client. But I don?t know how to set DCHP and how to call the
correct functions.

My question is: in a simple application, what is the configurations
and the exactly sequence of call functions should we use?

I try to use dchp_start(), dchp_discover()?but no results.

Please, help more urgent than possible!

If anyone knows how to do this, please, help me! Write for my email
[hidden email] or to this email list.

Thanks

Robson Paulo




_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users