source: libpacketdump/link_2.c @ c6fed13

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since c6fed13 was ace188a, checked in by Perry Lorier <perry@…>, 15 years ago

MacOS X is more picky about it's order of header files

  • Property mode set to 100644
File size: 752 bytes
RevLine 
[ace188a]1#include <sys/types.h>
[09d3bef]2#include <netinet/in.h>
3#include <stdio.h>
4#include <inttypes.h>
5#include <dlfcn.h>
6#include "libtrace.h"
7#include "libpacketdump.h"
8
9void decode(int link_type,char *packet,int len)
10{
11        char ether_buf[18] = {0, };
12        printf(" Ethernet:");
13        if (len>=6)
14                printf(" Dest: %s",trace_ether_ntoa((uint8_t *)packet, 
15                                        ether_buf));
16        else {
17                printf("[|Truncated]\n");
18                return;
19        }
20        if (len>=12) 
21                printf(" Source: %s",trace_ether_ntoa((uint8_t*)(packet+6), 
22                                        ether_buf));
23        else {
24                printf("[|Truncated]\n");
25                return;
26        }
27        if (len>=14) {
28                uint16_t type = htons(*(uint16_t*)(packet+12));
29                printf(" Ethertype: %04x\n",type);
30                decode_next(packet+14,len-14,"eth",type);
31        }
32        else {
33                printf("[|Truncated]\n");
34                return;
35        }
36        return;
37}
Note: See TracBrowser for help on using the repository browser.