source: libpacketdump/tcp_1720.cc @ 010fafb

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 010fafb was 950d54a, checked in by Perry Lorier <perry@…>, 16 years ago

Add libpacketdump to cvs

  • Property mode set to 100644
File size: 778 bytes
Line 
1// h323
2#include <stdio.h>
3#include <inttypes.h>
4#include <dlfcn.h>
5#include <map>
6#include "libpacketdump.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.