[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] HELP, PLease! DCHP Client
From: |
Robert Brown |
Subject: |
RE: [lwip-users] HELP, PLease! DCHP Client |
Date: |
Tue, 1 Nov 2005 21:15:12 -0500 |
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: address@hidden
[mailto:address@hidden Behalf
Of Robson
Sent: November 1, 2005 7:48 AM
To: address@hidden
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
address@hidden or to this email list.
Thanks
Robson Paulo