00001 /* 00002 * Copyright (c) 2001 - 2003 00003 * NetGroup, Politecnico di Torino (Italy) 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 00010 * 1. Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 2. Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in the 00014 * documentation and/or other materials provided with the distribution. 00015 * 3. Neither the name of the Politecnico di Torino nor the names of its 00016 * contributors may be used to endorse or promote products derived from 00017 * this software without specific prior written permission. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00020 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00021 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00022 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00023 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00024 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00025 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00026 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00027 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00029 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 */ 00032 00033 #ifndef __tcp_session 00034 #define __tcp_session 00035 00036 #ifdef WIN32 00037 #include "tme.h" 00038 #endif 00039 00040 #ifdef __FreeBSD__ 00041 00042 #ifdef _KERNEL 00043 #include <net/tme/tme.h> 00044 #else 00045 #include <tme/tme.h> 00046 #endif 00047 00048 #endif 00049 00050 #define UNKNOWN 0 00051 #define SYN_RCV 1 00052 #define SYN_ACK_RCV 2 00053 #define ESTABLISHED 3 00054 #define CLOSED_RST 4 00055 #define FIN_CLN_RCV 5 00056 #define FIN_SRV_RCV 6 00057 #define CLOSED_FIN 7 00058 #define ERROR_TCP 8 00059 #define FIRST_IS_CLN 0 00060 #define FIRST_IS_SRV 0xffffffff 00061 #define FIN_CLN 1 00062 #define FIN_SRV 2 00063 00064 #define MAX_WINDOW 65536 00065 00066 typedef struct __tcp_data 00067 { 00068 struct timeval timestamp_block; /*DO NOT MOVE THIS VALUE*/ 00069 struct timeval syn_timestamp; 00070 struct timeval last_timestamp; 00071 struct timeval syn_ack_timestamp; 00072 uint32 direction; 00073 uint32 seq_n_0_srv; 00074 uint32 seq_n_0_cln; 00075 uint32 ack_srv; /* acknowledge of (data sent by server) */ 00076 uint32 ack_cln; /* acknowledge of (data sent by client) */ 00077 uint32 status; 00078 uint32 pkts_cln_to_srv; 00079 uint32 pkts_srv_to_cln; 00080 uint32 bytes_srv_to_cln; 00081 uint32 bytes_cln_to_srv; 00082 uint32 close_state; 00083 } 00084 tcp_data; 00085 00086 #define FIN 1 00087 #define SYN 2 00088 #define RST 4 00089 #define PSH 8 00090 #define ACK 16 00091 #define URG 32 00092 00093 #define TCP_SESSION 0x00000800 00094 uint32 tcp_session(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data); 00095 00096 #endif