add pipacs package (thanks to Janos)
[openwrt/svn-archive/archive.git] / openwrt / package / pipacs / src / parser.h
1 #define LINUX 1
2 #ifdef LINUX
3 #include <ctype.h>
4 #include <string.h>
5 #include <sys/time.h>
6 #include <sys/types.h>
7 #include <sys/socket.h>
8 #include <sys/stat.h>
9 #include <sys/ioctl.h>
10 #include <netdb.h>
11 #include <unistd.h>
12 #include <arpa/inet.h>
13 #include <net/if.h>
14 #define BYTE unsigned char
15 #define DWORD unsigned long
16 #define BOOL char
17 #define TRUE 1
18 #define FALSE 0
19 #define WSADATA int
20 #define SOCKET int
21 #define SOCKADDR struct sockaddr
22 #define SOCKADDR_IN struct sockaddr_in
23 typedef struct _WSABUF {
24 unsigned long len;
25 unsigned char *buf;
26 } WSABUF;
27 #define SIO_RCVALL 0
28 #define SIO_RCVALL_IGMPMCAST 0
29 #define SIO_RCVALL_MCAST 0
30 #define ETH_P_ALL 0x0003
31 #else // WINDOWS
32
33 #include <winsock2.h>
34 #include <windows.h>
35
36 #endif
37
38 #ifndef _RCVALL_H_
39 #define _RCVALL_H_
40
41
42 #define MAX_IP_SIZE 65535
43 #define MIN_IP_HDR_SIZE 20
44
45 #define HI_WORD(byte) (((byte) >> 4) & 0x0F)
46 #define LO_WORD(byte) ((byte) & 0x0F)
47
48 extern char *szProto[];
49
50
51
52 void PrintRawBytes (BYTE *ptr, DWORD len);
53 int DecodeIGMPHeader(WSABUF *wsabuf, DWORD iphdrlen);
54 int DecodeUDPHeader (WSABUF *wsabuf, DWORD iphdrlen);
55 int DecodeTCPHeader (WSABUF *wsabuf, DWORD iphdrlenz);
56 int DecodeIPHeader (WSABUF *wasbuf, unsigned int srcaddr, unsigned short srcport, unsigned long srcnet,
57 unsigned int destaddr, unsigned short destport, unsigned long destnet, DWORD bytesret,
58 unsigned short xport, unsigned int xip, unsigned long xnet);
59
60 #endif