Tcp4Proto.h revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/** @file
Tcp Protocol header file.
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _TCP4_PROTO_H_
#define _TCP4_PROTO_H_
#include "Tcp4Driver.h"
#include "Socket.h"
#include "Tcp4Option.h"
///
/// Tcp states, Don't change their order, it is used as
/// index to mTcpOutFlag and other macros
///
#define TCP_CLOSED 0
#define TCP_LISTEN 1
#define TCP_SYN_SENT 2
#define TCP_SYN_RCVD 3
#define TCP_ESTABLISHED 4
#define TCP_FIN_WAIT_1 5
#define TCP_FIN_WAIT_2 6
#define TCP_CLOSING 7
#define TCP_TIME_WAIT 8
#define TCP_CLOSE_WAIT 9
#define TCP_LAST_ACK 10
///
/// Flags in the TCP header
///
#define TCP_FLG_FIN 0x01
#define TCP_FLG_SYN 0x02
#define TCP_FLG_RST 0x04
#define TCP_FLG_PSH 0x08
#define TCP_FLG_ACK 0x10
#define TCP_FLG_URG 0x20
//
// mask for all the flags
//
#define TCP_FLG_FLAG 0x3F
//
// Current congestion status as suggested by RFC3782.
//
//
// TCP control flags
//
//
// Timer related values
//
#define TCP_TIMER_CONNECT 0 ///< Connection establishment timer
//
// Default values for some timers
//
#define TCP_MAX_KEEPALIVE 8
//
// The header space to be reserved before TCP data to accomodate :
// 60byte IP head + 60byte TCP head + link layer head
//
#define TCP_MAX_HEAD 192
//
// Value ranges for some control option
//
#define TCP_BACKLOG 10
#define TCP_BACKLOG_MIN 5
#define TCP_MAX_LOSS_MIN 6
#define TCP_MAX_KEEPALIVE_MIN 4
///
/// TCP segmentation data
///
typedef struct _TCP_SEG {
} TCP_SEG;
///
/// Network endpoint, IP+Port structure
///
typedef struct _TCP_PEER {
} TCP_PEER;
///
/// TCP control block, it includes various states
///
struct _TCP_CB {
//
// RFC793 and RFC1122 defined variables
//
///< header: Src IP, Dst IP, 0, Protocol,
///< not include the TCP length.
///< It is necessary because of delayed ACK
//
// RFC1323 defined variables, about window scale,
// timestamp and PAWS
//
//
// RFC2988 defined variables. about RTT measurement
//
//
// RFC2581, and 3782 variables.
// Congestion control + NewReno fast recovery.
//
//
// configuration parameters, for EFI_TCP4_PROTOCOL specification
//
//
// configuration for tcp provided by user
//
};
extern LIST_ENTRY mTcpRunQue;
extern LIST_ENTRY mTcpListenQue;
extern TCP_SEQNO mTcpGlobalIss;
///
/// TCP_CONNECTED: both ends have synchronized their ISN.
///
#define TCP_FIN_RCVD(State) \
(((State) == TCP_CLOSE_WAIT) || \
((State) == TCP_LAST_ACK) || \
((State) == TCP_CLOSING) || \
((State) == TCP_TIME_WAIT))
#define TCP_LOCAL_CLOSED(State) \
(((State) == TCP_FIN_WAIT_1) || \
((State) == TCP_FIN_WAIT_2) || \
((State) == TCP_CLOSING) || \
((State) == TCP_TIME_WAIT) || \
((State) == TCP_LAST_ACK))
//
// Get the TCP_SEG point from a net buffer's ProtoData
//
//
// macros to compare sequence no
//
//
// TCP_SEQ_BETWEEN return whether b <= m <= e
//
#define TCP_SEQ_BETWEEN(b, m, e) ((e) - (b) >= (m) - (b))
//
// TCP_SUB_SEQ returns Seq1 - Seq2. Make sure Seq1 >= Seq2
//
//
// Check whether Flag is on
//
//
// Set and Clear operation on a Flag
//
//
// Test whether two peers are equal
//
//
// Test whether Pa matches Pb, or Pa is more specific
// than pb. Zero means wildcard.
//
#define TCP_MAX_WIN 0xFFFFU
typedef
(*TCP_TIMER_HANDLER) (
);
#endif