source: libpacketdump/eth_34916.c @ 11c0f44

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 11c0f44 was 11c0f44, checked in by Shane Alcock <salcock@…>, 13 years ago
  • Added support for skipping past PPPoE headers when calling trace_get_layer3
  • Fixed byte order issues in the libpacketdump PPPoE decoder
  • Fixed PPP header definition to match the RFC definition
  • Property mode set to 100644
File size: 820 bytes
RevLine 
[0c47bf4]1
2#include <sys/types.h>
3#include <netinet/in.h>
4#include <stdio.h>
5#include "libpacketdump.h"
6#include "libtrace.h"
7#include "libtrace_int.h"
8
9typedef struct pppoe_t {
10        LT_BITFIELD8    ver:4;
11        LT_BITFIELD8    type:4;
12        uint8_t         code;
13        uint16_t        session;
14        uint16_t        length;
15} pppoe_t;
16
[11a7f9c]17void decode(int link_type,const char *pkt,unsigned len) 
[0c47bf4]18{
19        pppoe_t *pppoe = (pppoe_t *) pkt;
20       
21        if (len < sizeof(*pppoe)) {
22                printf(" PPPoE: Truncated (len = %u)\n", len);
23                return;
24        }
25
26        printf(" PPPoE: Version: %d\n",pppoe->ver);
27        printf(" PPPoE: Type: %d\n",pppoe->type);
28        printf(" PPPoE: Code: %d\n",pppoe->code);
[11c0f44]29        printf(" PPPoE: Session: %d\n",ntohs(pppoe->session));
30        printf(" PPPoE: Length: %d\n",ntohs(pppoe->length));
[0c47bf4]31
32        /* Meh.. pass it off to eth decoder */
33        decode_next(pkt + sizeof(*pppoe), len - sizeof(*pppoe), "link", 5);
34
35}
36
37
Note: See TracBrowser for help on using the repository browser.