File: link_10.c

package info (click to toggle)
libtrace3 3.0.14-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 11,492 kB
  • sloc: ansic: 21,584; sh: 10,236; cpp: 1,765; makefile: 454; yacc: 96; lex: 50
file content (23 lines) | stat: -rw-r--r-- 525 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <sys/types.h>
#include <netinet/in.h>
#include <stdio.h>
#include "libpacketdump.h"
#include "libtrace.h"

DLLEXPORT void decode(int link_type UNUSED,const char *packet,unsigned len)
{
	// ATM
	printf(" Legacy Framing:");
	if (len>=12) {
		uint16_t type = htons(*(uint16_t*)(packet+sizeof(libtrace_atm_cell_t)+4));
		printf(" %04x\n",type);
		decode_next(packet+sizeof(libtrace_atm_cell_t) + 4,
				len-sizeof(libtrace_atm_cell_t) -4, 
				"eth",type);
	}
	else {
		printf("[|Truncated]\n");
		return;
	}
	return;
}