source: examples/tracedump/tcp_1720.cc @ 258c1fb

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

Fixes to TCP
Fixes to ASN1 parsing

  • Property mode set to 100644
File size: 772 bytes
Line 
1// h323
2#include <stdio.h>
3#include <stdint.h>
4#include <dlfcn.h>
5#include <map>
6#include "tracedump.h"
7#include <netinet/tcp.h>
8#include <netinet/in.h>
9#include "asn1.h"
10
11#define SAFE(x) \
12        ((unsigned int)len>=((char*)&tcp->x-(char*)tcp+sizeof(tcp->x)))
13#define DISPLAY_EXP(x,fmt,exp) \
14        if (SAFE(x)) \
15                printf(fmt,exp); \
16        else \
17                return;
18
19#define DISPLAY(x,fmt) DISPLAY_EXP(x,fmt,tcp->x)
20
21#define DISPLAYS(x,fmt) DISPLAY_EXP(x,fmt,htons(tcp->x))
22#define DISPLAYL(x,fmt) DISPLAY_EXP(x,fmt,htonl(tcp->x))
23#define DISPLAYIP(x,fmt) DISPLAY_EXP(x,fmt,inet_ntoa(*(struct in_addr*)&tcp->x))
24
25extern "C"
26void decode(int link_type,char *packet,int len)
27{
28        ASN asn;
29        if (len<=0)
30                return;
31        asn.feed(packet,len);
32        while (!asn.eof())
33                asn.getEncoding()->display();
34        return;
35}
Note: See TracBrowser for help on using the repository browser.