tcp_session.h
上传用户:fzchengxin
上传日期:2013-10-17
资源大小:2070k
文件大小:2k
源码类别:

Windows编程

开发平台:

Visual C++

  1. /*
  2.  * Copyright (c) 2001
  3.  * Politecnico di Torino.  All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that: (1) source code distributions
  7.  * retain the above copyright notice and this paragraph in its entirety, (2)
  8.  * distributions including binary code include the above copyright notice and
  9.  * this paragraph in its entirety in the documentation or other materials
  10.  * provided with the distribution, and (3) all advertising materials mentioning
  11.  * features or use of this software display the following acknowledgement:
  12.  * ``This product includes software developed by the Politecnico
  13.  * di Torino, and its contributors.'' Neither the name of
  14.  * the University nor the names of its contributors may be used to endorse
  15.  * or promote products derived from this software without specific prior
  16.  * written permission.
  17.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  18.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  19.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  20.  */
  21. #ifndef __tcp_session
  22. #define __tcp_session
  23. #ifdef WIN32
  24. #include "tme.h"
  25. #endif
  26. #ifdef __FreeBSD__
  27. #ifdef _KERNEL
  28. #include <net/tme/tme.h>
  29. #else
  30. #include <tme/tme.h>
  31. #endif
  32. #endif
  33. #define UNKNOWN 0
  34. #define SYN_RCV 1
  35. #define SYN_ACK_RCV 2
  36. #define ESTABLISHED 3
  37. #define CLOSED_RST 4
  38. #define FIN_CLN_RCV 5
  39. #define FIN_SRV_RCV 6
  40. #define CLOSED_FIN 7
  41. #define ERROR_TCP 8
  42. #define FIRST_IS_CLN 0
  43. #define FIRST_IS_SRV 0xffffffff
  44. #define FIN_CLN 1
  45. #define FIN_SRV 2
  46. #define MAX_WINDOW 65536
  47. typedef struct __tcp_data
  48. {
  49. struct timeval timestamp_block; /*DO NOT MOVE THIS VALUE*/
  50. struct timeval syn_timestamp;
  51. struct timeval last_timestamp;
  52. struct timeval syn_ack_timestamp;
  53. uint32 direction;
  54. uint32 seq_n_0_srv;
  55. uint32 seq_n_0_cln;
  56. uint32 ack_srv; /* acknowledge of (data sent by server) */
  57. uint32 ack_cln; /* acknowledge of (data sent by client) */
  58. uint32 status;
  59. uint32 pkts_cln_to_srv;
  60. uint32 pkts_srv_to_cln;
  61. uint32 bytes_srv_to_cln;
  62. uint32 bytes_cln_to_srv;
  63. uint32 close_state;
  64. }
  65.  tcp_data;
  66. #define FIN 1
  67. #define SYN 2
  68. #define RST 4
  69. #define PSH 8
  70. #define ACK 16
  71. #define URG 32
  72. #define TCP_SESSION 0x00000800
  73. uint32 tcp_session(uint8 *block, uint32 pkt_size, TME_DATA *data, MEM_TYPE *mem_ex, uint8 *mem_data);
  74. #endif