sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2001 - 2003
|
sl@0
|
3 |
* NetGroup, Politecnico di Torino (Italy)
|
sl@0
|
4 |
* All rights reserved.
|
sl@0
|
5 |
*
|
sl@0
|
6 |
* Redistribution and use in source and binary forms, with or without
|
sl@0
|
7 |
* modification, are permitted provided that the following conditions
|
sl@0
|
8 |
* are met:
|
sl@0
|
9 |
*
|
sl@0
|
10 |
* 1. Redistributions of source code must retain the above copyright
|
sl@0
|
11 |
* notice, this list of conditions and the following disclaimer.
|
sl@0
|
12 |
* 2. Redistributions in binary form must reproduce the above copyright
|
sl@0
|
13 |
* notice, this list of conditions and the following disclaimer in the
|
sl@0
|
14 |
* documentation and/or other materials provided with the distribution.
|
sl@0
|
15 |
* 3. Neither the name of the Politecnico di Torino nor the names of its
|
sl@0
|
16 |
* contributors may be used to endorse or promote products derived from
|
sl@0
|
17 |
* this software without specific prior written permission.
|
sl@0
|
18 |
*
|
sl@0
|
19 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
sl@0
|
20 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
sl@0
|
21 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
sl@0
|
22 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
sl@0
|
23 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
sl@0
|
24 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
sl@0
|
25 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
sl@0
|
26 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
sl@0
|
27 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
sl@0
|
28 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
sl@0
|
29 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
sl@0
|
30 |
*
|
sl@0
|
31 |
*/
|
sl@0
|
32 |
|
sl@0
|
33 |
#ifndef __tcp_session
|
sl@0
|
34 |
#define __tcp_session
|
sl@0
|
35 |
|
sl@0
|
36 |
#ifdef WIN32
|
sl@0
|
37 |
#include "tme.h"
|
sl@0
|
38 |
#endif
|
sl@0
|
39 |
|
sl@0
|
40 |
#ifdef __FreeBSD__
|
sl@0
|
41 |
|
sl@0
|
42 |
#ifdef _KERNEL
|
sl@0
|
43 |
#include <net/tme/tme.h>
|
sl@0
|
44 |
#else
|
sl@0
|
45 |
#include <tme/tme.h>
|
sl@0
|
46 |
#endif
|
sl@0
|
47 |
|
sl@0
|
48 |
#endif
|
sl@0
|
49 |
|
sl@0
|
50 |
#define UNKNOWN 0
|
sl@0
|
51 |
#define SYN_RCV 1
|
sl@0
|
52 |
#define SYN_ACK_RCV 2
|
sl@0
|
53 |
#define ESTABLISHED 3
|
sl@0
|
54 |
#define CLOSED_RST 4
|
sl@0
|
55 |
#define FIN_CLN_RCV 5
|
sl@0
|
56 |
#define FIN_SRV_RCV 6
|
sl@0
|
57 |
#define CLOSED_FIN 7
|
sl@0
|
58 |
#define ERROR_TCP 8
|
sl@0
|
59 |
#define FIRST_IS_CLN 0
|
sl@0
|
60 |
#define FIRST_IS_SRV 0xffffffff
|
sl@0
|
61 |
#define FIN_CLN 1
|
sl@0
|
62 |
#define FIN_SRV 2
|
sl@0
|
63 |
|
sl@0
|
64 |
#define MAX_WINDOW 65536
|
sl@0
|
65 |
|
sl@0
|
66 |
typedef struct __tcp_data
|
sl@0
|
67 |
{
|
sl@0
|
68 |
struct timeval timestamp_block; /*DO NOT MOVE THIS VALUE*/
|
sl@0
|
69 |
struct timeval syn_timestamp;
|
sl@0
|
70 |
struct timeval last_timestamp;
|
sl@0
|
71 |
struct timeval syn_ack_timestamp;
|
sl@0
|
72 |
uint32 direction;
|
sl@0
|
73 |
uint32 seq_n_0_srv;
|
sl@0
|
74 |
uint32 seq_n_0_cln;
|
sl@0
|
75 |
uint32 ack_srv; /* acknowledge of (data sent by server) */
|
sl@0
|
76 |
uint32 ack_cln; /* acknowledge of (data sent by client) */
|
sl@0
|
77 |
uint32 status;
|
sl@0
|
78 |
uint32 pkts_cln_to_srv;
|
sl@0
|
79 |
uint32 pkts_srv_to_cln;
|
sl@0
|
80 |
uint32 bytes_srv_to_cln;
|
sl@0
|
81 |
uint32 bytes_cln_to_srv;
|
sl@0
|
82 |
uint32 close_state;
|
sl@0
|
83 |
}
|
sl@0
|
84 |
tcp_data;
|
sl@0
|
85 |
|
sl@0
|
86 |
#define FIN 1
|
sl@0
|
87 |
#define SYN 2
|
sl@0
|
88 |
#define RST 4
|
sl@0
|
89 |
#define PSH 8
|
sl@0
|
90 |
#define ACK 16
|
sl@0
|
91 |
#define URG 32
|
sl@0
|
92 |
|
sl@0
|
93 |
#define TCP_SESSION 0x00000800
|
sl@0
|
94 |
uint32 tcp_session(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data);
|
sl@0
|
95 |
|
sl@0
|
96 |
#endif |