source: examples/tracedump/link_10.cc @ 57bbf89

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 57bbf89 was 57bbf89, checked in by Daniel Lawson <dlawson@…>, 16 years ago

added linktypes for the legacy dag traces.
link_9 and link_10 are POS and ATM, and currently just skip the link layer
link_11 is ethernet - it steps over the legacy framing and then fires
link_2. this is hardcoded behaviour, so perhaps not the best... :)

  • Property mode set to 100644
File size: 685 bytes
Line 
1#include <netinet/ether.h>
2#include <netinet/in.h>
3#include <stdio.h>
4#include <inttypes.h>
5#include <dlfcn.h>
6#include <map>
7#include "tracedump.h"
8
9extern "C"
10void decode(int link_type,char *packet,int len)
11{
12        printf(" Legacy ATM:");
13        /*
14        if (len>=6)
15                printf(" %s",ether_ntoa((struct ether_addr*)packet));
16        else {
17                printf("[|Truncated]\n");
18                return;
19        }
20        if (len>=12)
21                printf(" %s",ether_ntoa((struct ether_addr*)(packet+6)));
22        else {
23                printf("[|Truncated]\n");
24                return;
25        }
26        */
27        if (len>=24) {
28                uint16_t type = htons(*(uint16_t*)(packet+22));
29                printf(" %04x\n",type);
30                decode_next(packet+24,len-24,"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.