/* $Header: arp.c,v 1.2 87/10/21 15:53:35 mar Exp $ */


#include <stdio.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <netinet/if_ether.h>


do_arp(pbuf, p)
char *pbuf;
unsigned char *p;
{
    char	tmp[256];

    switch (p[7]) {
    case ARPOP_REQUEST:
	sprintf(tmp, "ARP Req sender %d.%d.%d.%d (%02x%02x%02x%02x%02x%02x) target %d.%d.%d.%d ",
		p[14], p[15], p[16], p[17],
		p[8], p[9], p[10], p[11], p[12], p[13],
		p[24], p[25], p[26], p[27]);
	strcat(pbuf, tmp);
	break;
    case ARPOP_REPLY:
	sprintf(tmp, "ARP Reply sender %d.%d.%d.%d (%02x%02x%02x%02x%02x%02x) target %d.%d.%d.%d (%02x%02x%02x%02x%02x%02x) ",
		p[14], p[15], p[16], p[17],
		p[8], p[9], p[10], p[11], p[12], p[13],
		p[24], p[25], p[26], p[27],
		p[19], p[19], p[20], p[21], p[22], p[23]);
	strcat(pbuf, tmp);
	break;
    default:
	strcat(pbuf, "ARP ? ");
    }
}
