00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00029 #ifndef PACKET_PARSER_H
00030 #define PACKET_PARSER_H
00031
00032 #include "ipv6.h"
00033 #include <sys/types.h>
00034
00035 #ifdef TRACKING_WITH_PAYLOAD
00036 # define PAYLOAD_SAMPLE 8
00037 # define PAYLOAD6_SAMPLE PAYLOAD_SAMPLE
00038 #endif
00039
00041 typedef enum {
00042 TCP_STATE_DROP = 0,
00043 TCP_STATE_OPEN,
00044 TCP_STATE_ESTABLISHED,
00045 TCP_STATE_CLOSE,
00046 TCP_STATE_UNKNOW
00047 } tcp_state_t;
00048
00053 typedef struct {
00054
00055
00056
00057 struct in6_addr saddr;
00058 struct in6_addr daddr;
00059 u_int8_t protocol;
00060 u_int8_t padding;
00062 u_int16_t dest;
00063 u_int16_t source;
00065 u_int8_t type;
00066 u_int8_t code;
00069 #ifdef TRACKING_WITH_PAYLOAD
00070 char payload[PAYLOAD_SAMPLE];
00071 #endif
00072 } tracking_t;
00073
00074 unsigned int get_ip_headers(tracking_t * tracking,
00075 const unsigned char *dgram,
00076 unsigned int dgram_size);
00077 int get_udp_headers(tracking_t * tracking, const unsigned char *dgram,
00078 unsigned int dgram_size);
00079 tcp_state_t get_tcp_headers(tracking_t * tracking,
00080 const unsigned char *dgram,
00081 unsigned int dgram_size);
00082 int get_icmp_headers(tracking_t * tracking, const unsigned char *dgram,
00083 unsigned int dgram_size);
00084 int get_icmpv6_headers(tracking_t * tracking, const unsigned char *dgram,
00085 unsigned int dgram_size);
00086
00087 #endif