# Include <stdio. h>
# Include <pcap. h>
Typedef struct mac_header
{
Unsigned char d [6];
Unsigned char s [6];
Unsigned short type;
} Mac_header;
Void packet_handler (u_char * Param, const struct pcap_pkthdr * Header, const u_char * pkt_data );
Int main (INT argc, char * argv [])
{
Char * device;
Char errbuf [pcap_errbuf_size];
Pcap_t * P;
Device = pcap_lookupdev (errbuf );
P = pcap_open_live (device, 65536,1, 1000, errbuf );
Pcap_loop (p, 0, packet_handler, null );
Return (0 );
}
Void packet_handler (u_char * Param, const struct pcap_pkthdr * Header, const u_char * pkt_data)
{
Int I;
Mac_header * mac_header;
Mac_header = (mac_header *) pkt_data;
If (mac_header-> type = 0x0608)
{
Printf ("pppoe ARP \ n ");
For (I = 0; I <6; I ++)
Printf ("% 02x", pkt_data [I]);
Putchar ('\ n ');
For (I = 6; I <12; I ++)
Printf ("% 02x", pkt_data [I]);
Putchar ('\ n ');
}
}