1 #ifndef _TCP_H 2 #define _TCP_H 3 4 #define TCP_INITIAL_TIMEOUT (3*TICKS_PER_SEC) 5 #define TCP_MAX_TIMEOUT (60*TICKS_PER_SEC) 6 #define TCP_MIN_TIMEOUT (TICKS_PER_SEC) 7 #define TCP_MAX_RETRY 10 8 #define TCP_MAX_HEADER ((int)sizeof(struct iphdr)+64) 9 #define TCP_MIN_WINDOW (1500-TCP_MAX_HEADER) 10 #define TCP_MAX_WINDOW (65535-TCP_MAX_HEADER) 11 12 #define FIN 1 13 #define SYN 2 14 #define RST 4 15 #define PSH 8 16 #define ACK 16 17 #define URG 32 18 19 20 struct tcphdr { 21 uint16_t src; 22 uint16_t dst; 23 int32_t seq; 24 int32_t ack; 25 uint16_t ctrl; 26 uint16_t window; 27 uint16_t chksum; 28 uint16_t urgent; 29 }; 30 31 extern int tcp_transaction ( unsigned long destip, unsigned int destsock, 32 void *ptr, 33 int (*send)(int len, void *buf, void *ptr), 34 int (*recv)(int len, const void *buf, void *ptr)); 35 36 37 #endif /* _TCP_H */ 38