The RARP library contains support for sending RARP requests and handling the RARP answer packet. (Enhanced Network Stack Library required)
The library is used by calling rarp_send(&callback).The callback function will receive the IP address as an argument. Example:
unsigned char myip[4];
void callback(unsigned long ip)
{
myip[0] = (ip >> 24L) & 0xff;
myip[1] = (ip >> 16L) & 0xff;
myip[2] = (ip >> 8L) & 0xff;
myip[3] = ip & 0xff;
have_ip = 1;
}
...
have_ip = 0;
rarp_send(&callback);
task_sleep(0, 2500);
if (have_ip)
printf("Received IP %bu.%bu.%bu.%bu\n", myip[0], myip[1], myip[2], myip[3]);
else
rarp_stop();
The RARP sample application registers a callback and performs a RARP request.
Download