]> andersk Git - libfaim.git/blame - utils/aimdump/util.c
- Wed Nov 8 02:23:25 UTC 2000
[libfaim.git] / utils / aimdump / util.c
CommitLineData
fa684c51 1/*
2 *
3 *
4 *
5 */
6
7#include "aimdump.h"
8
9char *printether(u_int8_t *addr)
10{
11 static char out[18];
12
13 memset(out, 0, 18);
14 sprintf(out, "%02x:%02x:%02x:%02x:%02x:%02x",
15 addr[0], addr[1],
16 addr[2], addr[3],
17 addr[4], addr[5]);
18
19 return out;
20}
21
22int cmpether(u_int8_t *addr, u_int8_t *addr2)
23{
24 int i;
25 for (i=0; i<ETH_ALEN; i++)
26 {
27 if (addr[i] != addr2[i])
28 return 0;
29 }
30 return 1;
31}
32
33void printframe(struct pcap_pkthdr *hdr, char *pkt)
34{
35 int i;
36 struct ether_header *ether = NULL;
37
38 if ( (!hdr) || (!pkt) )
39 return;
40
41 if (hdr->caplen != hdr->len)
42 fprintf(stderr, "rpld: caplen/len mismatch\n");
43
44 ether = (struct ether_header *)pkt;
45
46 printf("\n\nrpld: %s > ", printether(ether->ether_shost));
47 printf("%s\n", printether(ether->ether_dhost));
48
49 //pkt = 18; /* skip over ethernet headers */
50 for (i=0;i<hdr->caplen;i+=2)
51 {
52 if (!((i)%8))
53 printf("\nrpld:\t");
54 printf("%02x%02x ", pkt[i] &0xff, pkt[i+1] & 0xff);
55 }
56}
This page took 0.153577 seconds and 5 git commands to generate.