ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

tcp.h
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:   See COPYING in the top level directory
00003  * PROJECT:     ReactOS TCP/IP protocol driver
00004  * FILE:        include/tcp.h
00005  * PURPOSE:     Transmission Control Protocol definitions
00006  */
00007 
00008 #pragma once
00009 
00010 typedef VOID
00011 (*PTCP_COMPLETION_ROUTINE)( PVOID Context, NTSTATUS Status, ULONG Count );
00012 
00013 /* TCPv4 header structure */
00014 #include <pshpack1.h>
00015 typedef struct TCPv4_HEADER {
00016   USHORT SourcePort;        /* Source port */
00017   USHORT DestinationPort;   /* Destination port */
00018   ULONG  SequenceNumber;    /* Sequence number */
00019   ULONG  AckNumber;         /* Acknowledgement number */
00020   UCHAR  DataOffset;        /* Data offset; 32-bit words (leftmost 4 bits) */
00021   UCHAR  Flags;             /* Control bits (rightmost 6 bits) */
00022   USHORT Window;            /* Maximum acceptable receive window */
00023   USHORT Checksum;          /* Checksum of segment */
00024   USHORT Urgent;            /* Pointer to urgent data */
00025 } TCPv4_HEADER, *PTCPv4_HEADER;
00026 
00027 #define TCPOPT_END_OF_LIST  0x0
00028 #define TCPOPT_NO_OPERATION 0x1
00029 #define TCPOPT_MAX_SEG_SIZE 0x2
00030 
00031 #define TCPOPTLEN_MAX_SEG_SIZE  0x4
00032 
00033 /* Data offset; 32-bit words (leftmost 4 bits); convert to bytes */
00034 #define TCP_DATA_OFFSET(DataOffset)(((DataOffset) & 0xF0) >> (4-2))
00035 
00036 
00037 /* TCPv4 pseudo header */
00038 typedef struct TCPv4_PSEUDO_HEADER {
00039   ULONG SourceAddress;      /* Source address */
00040   ULONG DestinationAddress; /* Destination address */
00041   UCHAR Zero;               /* Reserved */
00042   UCHAR Protocol;           /* Protocol */
00043   USHORT TCPLength;         /* Size of TCP segment */
00044 } TCPv4_PSEUDO_HEADER, *PTCPv4_PSEUDO_HEADER;
00045 #include <poppack.h>
00046 
00047 typedef struct _SLEEPING_THREAD {
00048     LIST_ENTRY Entry;
00049     PVOID SleepToken;
00050     KEVENT Event;
00051 } SLEEPING_THREAD, *PSLEEPING_THREAD;
00052 
00053 typedef struct _CLIENT_DATA {
00054     BOOLEAN Unlocked;
00055     KSPIN_LOCK Lock;
00056     KIRQL OldIrql;
00057 } CLIENT_DATA, *PCLIENT_DATA;
00058 
00059 /* Retransmission timeout constants */
00060 
00061 /* Lower bound for retransmission timeout in TCP timer ticks */
00062 #define TCP_MIN_RETRANSMISSION_TIMEOUT    1*1000          /* 1 tick */
00063 
00064 /* Upper bound for retransmission timeout in TCP timer ticks */
00065 #define TCP_MAX_RETRANSMISSION_TIMEOUT    1*60*1000       /* 1 tick */
00066 
00067 /* Smoothing factor */
00068 #define TCP_ALPHA_RETRANSMISSION_TIMEOUT(x)(((x)*8)/10)   /* 0.8 */
00069 
00070 /* Delay variance factor */
00071 #define TCP_BETA_RETRANSMISSION_TIMEOUT(x)(((x)*16)/10)   /* 1.6 */
00072 
00073 #define SEL_CONNECT 1
00074 #define SEL_FIN     2
00075 #define SEL_RST     4
00076 #define SEL_ABRT    8
00077 #define SEL_READ    16
00078 #define SEL_WRITE   32
00079 #define SEL_ACCEPT  64
00080 #define SEL_OOB     128
00081 #define SEL_ERROR   256
00082 #define SEL_FINOUT  512
00083 
00084 #define FREAD       0x0001
00085 #define FWRITE      0x0002
00086 
00087 /* Datagram/segment send request flags */
00088 
00089 #define SRF_URG   TCP_URG
00090 #define SRF_ACK   TCP_ACK
00091 #define SRF_PSH   TCP_PSH
00092 #define SRF_RST   TCP_RST
00093 #define SRF_SYN   TCP_SYN
00094 #define SRF_FIN   TCP_FIN
00095 
00096 extern LONG TCP_IPIdentification;
00097 extern CLIENT_DATA ClientInfo;
00098 
00099 /* accept.c */
00100 NTSTATUS TCPCheckPeerForAccept(PVOID Context,
00101                                PTDI_REQUEST_KERNEL Request);
00102 NTSTATUS TCPListen( PCONNECTION_ENDPOINT Connection, UINT Backlog );
00103 BOOLEAN TCPAbortListenForSocket( PCONNECTION_ENDPOINT Listener,
00104                      PCONNECTION_ENDPOINT Connection );
00105 NTSTATUS TCPAccept
00106 ( PTDI_REQUEST Request,
00107   PCONNECTION_ENDPOINT Listener,
00108   PCONNECTION_ENDPOINT Connection,
00109   PTCP_COMPLETION_ROUTINE Complete,
00110   PVOID Context );
00111 
00112 /* tcp.c */
00113 PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext );
00114 VOID TCPFreeConnectionEndpoint( PCONNECTION_ENDPOINT Connection );
00115 
00116 NTSTATUS TCPSocket( PCONNECTION_ENDPOINT Connection,
00117             UINT Family, UINT Type, UINT Proto );
00118 
00119 VOID HandleSignalledConnection(PCONNECTION_ENDPOINT Connection);
00120 
00121 PTCP_SEGMENT TCPCreateSegment(
00122   PIP_PACKET IPPacket,
00123   PTCPv4_HEADER TCPHeader,
00124   ULONG SegmentLength);
00125 
00126 VOID TCPFreeSegment(
00127   PTCP_SEGMENT Segment);
00128 
00129 VOID TCPAddSegment(
00130   PCONNECTION_ENDPOINT Connection,
00131   PTCP_SEGMENT Segment,
00132   PULONG Acknowledged);
00133 
00134 NTSTATUS TCPConnect(
00135   PCONNECTION_ENDPOINT Connection,
00136   PTDI_CONNECTION_INFORMATION ConnInfo,
00137   PTDI_CONNECTION_INFORMATION ReturnInfo,
00138   PTCP_COMPLETION_ROUTINE Complete,
00139   PVOID Context);
00140 
00141 NTSTATUS TCPDisconnect(
00142   PCONNECTION_ENDPOINT Connection,
00143   UINT Flags,
00144   PLARGE_INTEGER Timeout,
00145   PTDI_CONNECTION_INFORMATION ConnInfo,
00146   PTDI_CONNECTION_INFORMATION ReturnInfo,
00147   PTCP_COMPLETION_ROUTINE Complete,
00148   PVOID Context);
00149 
00150 NTSTATUS TCPReceiveData(
00151   PCONNECTION_ENDPOINT Connection,
00152   PNDIS_BUFFER Buffer,
00153   ULONG ReceiveLength,
00154   PULONG BytesReceived,
00155   ULONG ReceiveFlags,
00156   PTCP_COMPLETION_ROUTINE Complete,
00157   PVOID Context);
00158 
00159 NTSTATUS TCPSendData(
00160   PCONNECTION_ENDPOINT Connection,
00161   PCHAR Buffer,
00162   ULONG DataSize,
00163   PULONG DataUsed,
00164   ULONG Flags,
00165   PTCP_COMPLETION_ROUTINE Complete,
00166   PVOID Context);
00167 
00168 NTSTATUS TCPClose( PCONNECTION_ENDPOINT Connection );
00169 
00170 NTSTATUS TCPTranslateError( const INT8 err );
00171 
00172 UINT TCPAllocatePort( const UINT HintPort );
00173 
00174 VOID TCPFreePort( const UINT Port );
00175 
00176 NTSTATUS TCPGetSockAddress
00177 ( PCONNECTION_ENDPOINT Connection,
00178   PTRANSPORT_ADDRESS TransportAddress,
00179   BOOLEAN RemoteAddress );
00180 
00181 NTSTATUS TCPStartup(
00182   VOID);
00183 
00184 NTSTATUS TCPShutdown(
00185   VOID);
00186 
00187 BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Connection, PIRP Irp );
00188 
00189 VOID
00190 TCPUpdateInterfaceLinkStatus(PIP_INTERFACE IF);
00191 
00192 VOID
00193 TCPUpdateInterfaceIPInformation(PIP_INTERFACE IF);
00194 
00195 VOID
00196 FlushListenQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status);
00197 
00198 VOID
00199 FlushConnectQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status);
00200 
00201 VOID
00202 FlushReceiveQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked);
00203 
00204 VOID
00205 FlushSendQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked);
00206 
00207 VOID
00208 FlushShutdownQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked);
00209 
00210 VOID
00211 FlushAllQueues(PCONNECTION_ENDPOINT Connection, NTSTATUS Status);
00212 
00213 VOID CompleteBucket(PCONNECTION_ENDPOINT Connection, PTDI_BUCKET Bucket, const BOOLEAN Synchronous);

Generated on Sun May 27 2012 04:28:06 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.