mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
Fix coding style issues for Tcp4Dxe driver.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6774 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
34ffd1bbb5
commit
85511ddf72
@ -558,7 +558,7 @@ SockCreate (
|
|||||||
|
|
||||||
Parent = SockInitData->Parent;
|
Parent = SockInitData->Parent;
|
||||||
|
|
||||||
if (Parent && (Parent->ConnCnt == Parent->BackLog)) {
|
if ((Parent != NULL) && (Parent->ConnCnt == Parent->BackLog)) {
|
||||||
DEBUG (
|
DEBUG (
|
||||||
(EFI_D_ERROR,
|
(EFI_D_ERROR,
|
||||||
"SockCreate: Socket parent has "
|
"SockCreate: Socket parent has "
|
||||||
@ -744,7 +744,7 @@ SockDestroy (
|
|||||||
//
|
//
|
||||||
// Remove it from parent connection list if needed
|
// Remove it from parent connection list if needed
|
||||||
//
|
//
|
||||||
if (Sock->Parent) {
|
if (Sock->Parent != NULL) {
|
||||||
|
|
||||||
RemoveEntryList (&(Sock->ConnectionList));
|
RemoveEntryList (&(Sock->ConnectionList));
|
||||||
(Sock->Parent->ConnCnt)--;
|
(Sock->Parent->ConnCnt)--;
|
||||||
@ -982,7 +982,7 @@ SockConnClosed (
|
|||||||
IN SOCKET *Sock
|
IN SOCKET *Sock
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Sock->CloseToken) {
|
if (Sock->CloseToken != NULL) {
|
||||||
SIGNAL_TOKEN (Sock->CloseToken, EFI_SUCCESS);
|
SIGNAL_TOKEN (Sock->CloseToken, EFI_SUCCESS);
|
||||||
Sock->CloseToken = NULL;
|
Sock->CloseToken = NULL;
|
||||||
}
|
}
|
||||||
|
@ -205,9 +205,7 @@ SockDestroyChild (
|
|||||||
data ProtoData.
|
data ProtoData.
|
||||||
|
|
||||||
@param SockInitData Inital data to setting the socket.
|
@param SockInitData Inital data to setting the socket.
|
||||||
@param ProtoData Pointer to the protocol specific data.
|
|
||||||
@param Len Length of the protocol specific data.
|
|
||||||
|
|
||||||
@return Pointer to the newly created socket. If NULL, error condition occured.
|
@return Pointer to the newly created socket. If NULL, error condition occured.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
@ -344,6 +344,14 @@ typedef struct _SOCK_INIT_DATA {
|
|||||||
|
|
||||||
EFI_HANDLE DriverBinding; // the driver binding handle
|
EFI_HANDLE DriverBinding; // the driver binding handle
|
||||||
} SOCK_INIT_DATA;
|
} SOCK_INIT_DATA;
|
||||||
|
|
||||||
|
//
|
||||||
|
//the union type of TCP and UDP protocol
|
||||||
|
//
|
||||||
|
typedef union {
|
||||||
|
EFI_TCP4_PROTOCOL TcpProtocol;
|
||||||
|
EFI_UDP4_PROTOCOL UdpProtocol;
|
||||||
|
} NET_PROTOCOL;
|
||||||
//
|
//
|
||||||
// the socket structure representing a network service access point
|
// the socket structure representing a network service access point
|
||||||
//
|
//
|
||||||
@ -391,10 +399,7 @@ struct _SOCKET {
|
|||||||
//
|
//
|
||||||
SOCK_PROTO_HANDLER ProtoHandler; // the request handler of protocol
|
SOCK_PROTO_HANDLER ProtoHandler; // the request handler of protocol
|
||||||
UINT8 ProtoReserved[PROTO_RESERVED_LEN]; // Data fields reserved for protocol
|
UINT8 ProtoReserved[PROTO_RESERVED_LEN]; // Data fields reserved for protocol
|
||||||
union {
|
NET_PROTOCOL NetProtocol;
|
||||||
EFI_TCP4_PROTOCOL TcpProtocol;
|
|
||||||
EFI_UDP4_PROTOCOL UdpProtocol;
|
|
||||||
} NetProtocol;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Callbacks.
|
// Callbacks.
|
||||||
|
@ -101,11 +101,11 @@ Tcp4GetMode (
|
|||||||
return EFI_NOT_STARTED;
|
return EFI_NOT_STARTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mode->Tcp4State) {
|
if (Mode->Tcp4State != NULL) {
|
||||||
*(Mode->Tcp4State) = (EFI_TCP4_CONNECTION_STATE) Tcb->State;
|
*(Mode->Tcp4State) = (EFI_TCP4_CONNECTION_STATE) Tcb->State;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mode->Tcp4ConfigData) {
|
if (Mode->Tcp4ConfigData != NULL) {
|
||||||
|
|
||||||
ConfigData = Mode->Tcp4ConfigData;
|
ConfigData = Mode->Tcp4ConfigData;
|
||||||
AccessPoint = &(ConfigData->AccessPoint);
|
AccessPoint = &(ConfigData->AccessPoint);
|
||||||
@ -220,13 +220,13 @@ Tcp4Bind (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flush the Tcb add its associated protocols..
|
Flush the Tcb add its associated protocols.
|
||||||
|
|
||||||
@param Tcb Pointer to the TCP_CB to be flushed.
|
@param Tcb Pointer to the TCP_CB to be flushed.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The operation is completed successfully.
|
None
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
Tcp4FlushPcb (
|
Tcp4FlushPcb (
|
||||||
IN TCP_CB *Tcb
|
IN TCP_CB *Tcb
|
||||||
@ -329,7 +329,6 @@ Tcp4DetachPcb (
|
|||||||
Configure the Tcb using CfgData.
|
Configure the Tcb using CfgData.
|
||||||
|
|
||||||
@param Sk Pointer to the socket of this TCP instance.
|
@param Sk Pointer to the socket of this TCP instance.
|
||||||
@param SkTcb Pointer to the TCP_CB of this TCP instance.
|
|
||||||
@param CfgData Pointer to the TCP configuration data.
|
@param CfgData Pointer to the TCP configuration data.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The operation is completed successfully.
|
@retval EFI_SUCCESS The operation is completed successfully.
|
||||||
|
@ -123,16 +123,14 @@ Tcp4CreateTimer (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Stop and destroy the heartbeat timer for TCP driver.
|
Stop and destroy the heartbeat timer for TCP driver.
|
||||||
|
|
||||||
None.
|
None
|
||||||
|
|
||||||
@return None.
|
None
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
Tcp4DestroyTimer (
|
Tcp4DestroyTimer ()
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
ASSERT (mTcp4Timer.RefCnt > 0);
|
ASSERT (mTcp4Timer.RefCnt > 0);
|
||||||
|
|
||||||
@ -147,32 +145,24 @@ Tcp4DestroyTimer (
|
|||||||
mTcp4Timer.TimerEvent = NULL;
|
mTcp4Timer.TimerEvent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
The entry point for Tcp4 driver.
|
||||||
|
Used to install Tcp4 driver on the ImageHandle.
|
||||||
|
|
||||||
|
@param ImageHandle The firmware allocated handle for this
|
||||||
|
driver image.
|
||||||
|
@param SystemTable Pointer to the EFI system table.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Driver loaded.
|
||||||
|
@retval other Driver not loaded.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
Tcp4DriverEntryPoint (
|
Tcp4DriverEntryPoint (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
The entry point for Tcp4 driver. used to install
|
|
||||||
Tcp4 driver on the ImageHandle.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
ImageHandle - The firmware allocated handle for this
|
|
||||||
driver image.
|
|
||||||
SystemTable - Pointer to the EFI system table.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - Driver loaded.
|
|
||||||
other - Driver not loaded.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 Seed;
|
UINT32 Seed;
|
||||||
|
@ -328,7 +328,7 @@ TcpTrimSegment (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Drop) {
|
if (Drop != 0) {
|
||||||
NetbufTrim (Nbuf, Drop, NET_BUF_HEAD);
|
NetbufTrim (Nbuf, Drop, NET_BUF_HEAD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ TcpTrimSegment (
|
|||||||
Drop--;
|
Drop--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Drop) {
|
if (Drop != 0) {
|
||||||
NetbufTrim (Nbuf, Drop, NET_BUF_TAIL);
|
NetbufTrim (Nbuf, Drop, NET_BUF_TAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -735,7 +735,7 @@ TcpInput (
|
|||||||
Len = Nbuf->TotalSize - (Head->HeadLen << 2);
|
Len = Nbuf->TotalSize - (Head->HeadLen << 2);
|
||||||
|
|
||||||
if ((Head->HeadLen < 5) || (Len < 0) ||
|
if ((Head->HeadLen < 5) || (Len < 0) ||
|
||||||
TcpChecksum (Nbuf, NetPseudoHeadChecksum (Src, Dst, 6, 0))) {
|
(TcpChecksum (Nbuf, NetPseudoHeadChecksum (Src, Dst, 6, 0)) != 0)) {
|
||||||
|
|
||||||
DEBUG ((EFI_D_INFO, "TcpInput: received an mal-formated packet\n"));
|
DEBUG ((EFI_D_INFO, "TcpInput: received an mal-formated packet\n"));
|
||||||
goto DISCARD;
|
goto DISCARD;
|
||||||
@ -953,7 +953,7 @@ TcpInput (
|
|||||||
//
|
//
|
||||||
// First step: Check whether SEG.SEQ is acceptable
|
// First step: Check whether SEG.SEQ is acceptable
|
||||||
//
|
//
|
||||||
if (!TcpSeqAcceptable (Tcb, Seg)) {
|
if (TcpSeqAcceptable (Tcb, Seg) == 0) {
|
||||||
DEBUG ((EFI_D_WARN, "TcpInput: sequence acceptance"
|
DEBUG ((EFI_D_WARN, "TcpInput: sequence acceptance"
|
||||||
" test failed for segment of TCB %p\n", Tcb));
|
" test failed for segment of TCB %p\n", Tcb));
|
||||||
|
|
||||||
@ -1371,13 +1371,13 @@ StepSix:
|
|||||||
// Tcb is a new child of the listening Parent,
|
// Tcb is a new child of the listening Parent,
|
||||||
// commit it.
|
// commit it.
|
||||||
//
|
//
|
||||||
if (Parent) {
|
if (Parent != NULL) {
|
||||||
Tcb->Parent = Parent;
|
Tcb->Parent = Parent;
|
||||||
TcpInsertTcb (Tcb);
|
TcpInsertTcb (Tcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Tcb->State != TCP_CLOSED) &&
|
if ((Tcb->State != TCP_CLOSED) &&
|
||||||
(!TcpToSendData (Tcb, 0)) &&
|
(TcpToSendData (Tcb, 0) == 0) &&
|
||||||
(TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_ACK_NOW) || Nbuf->TotalSize)) {
|
(TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_ACK_NOW) || Nbuf->TotalSize)) {
|
||||||
|
|
||||||
TcpToSendAck (Tcb);
|
TcpToSendAck (Tcb);
|
||||||
@ -1409,7 +1409,7 @@ DISCARD:
|
|||||||
DEBUG ((EFI_D_WARN, "Tcp4Input: Discard a packet\n"));
|
DEBUG ((EFI_D_WARN, "Tcp4Input: Discard a packet\n"));
|
||||||
NetbufFree (Nbuf);
|
NetbufFree (Nbuf);
|
||||||
|
|
||||||
if (Parent && Tcb) {
|
if ((Parent != NULL) && (Tcb != NULL)) {
|
||||||
|
|
||||||
ASSERT (Tcb->Sk);
|
ASSERT (Tcb->Sk);
|
||||||
TcpClose (Tcb);
|
TcpClose (Tcb);
|
||||||
|
@ -60,14 +60,19 @@ Tcp4ChkDataBuf (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Get the current operational status.
|
Get the current operational status.
|
||||||
|
|
||||||
|
The GetModeData() function copies the current operational settings of this
|
||||||
|
EFI TCPv4 Protocol instance into user-supplied buffers. This function can
|
||||||
|
also be used to retrieve the operational setting of underlying drivers
|
||||||
|
such as IPv4, MNP, or SNP.
|
||||||
|
|
||||||
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
||||||
@param Tcp4State Pointer to the buffer to receive the current TCP
|
@param Tcp4State Pointer to the buffer to receive the current TCP
|
||||||
state.
|
state.
|
||||||
@param Tcp4ConfigData Pointer to the buffer to receive the current TCP
|
@param Tcp4ConfigData Pointer to the buffer to receive the current TCP
|
||||||
configuration.
|
configuration.
|
||||||
@param Ip4ModeData Pointer to the buffer to receive the current
|
@param Ip4ModeData Pointer to the buffer to receive the current IPv4
|
||||||
IPv4 configuration.
|
configuration data used by the TCPv4 instance.
|
||||||
@param MnpConfigData Pointer to the buffer to receive the current MNP
|
@param MnpConfigData Pointer to the buffer to receive the current MNP
|
||||||
configuration data indirectly used by the TCPv4
|
configuration data indirectly used by the TCPv4
|
||||||
Instance.
|
Instance.
|
||||||
@ -84,12 +89,12 @@ Tcp4ChkDataBuf (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
Tcp4GetModeData (
|
Tcp4GetModeData (
|
||||||
IN CONST EFI_TCP4_PROTOCOL * This,
|
IN CONST EFI_TCP4_PROTOCOL *This,
|
||||||
OUT EFI_TCP4_CONNECTION_STATE * Tcp4State OPTIONAL,
|
OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,
|
||||||
OUT EFI_TCP4_CONFIG_DATA * Tcp4ConfigData OPTIONAL,
|
OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,
|
||||||
OUT EFI_IP4_MODE_DATA * Ip4ModeData OPTIONAL,
|
OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
|
||||||
OUT EFI_MANAGED_NETWORK_CONFIG_DATA * MnpConfigData OPTIONAL,
|
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
|
||||||
OUT EFI_SIMPLE_NETWORK_MODE * SnpModeData OPTIONAL
|
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
TCP4_MODE_DATA TcpMode;
|
TCP4_MODE_DATA TcpMode;
|
||||||
@ -114,6 +119,22 @@ Tcp4GetModeData (
|
|||||||
/**
|
/**
|
||||||
Initialize or brutally reset the operational parameters for
|
Initialize or brutally reset the operational parameters for
|
||||||
this EFI TCPv4 instance.
|
this EFI TCPv4 instance.
|
||||||
|
|
||||||
|
The Configure() function does the following:
|
||||||
|
* Initialize this EFI TCPv4 instance, i.e., initialize the communication end
|
||||||
|
setting, specify active open or passive open for an instance.
|
||||||
|
* Reset this TCPv4 instance brutally, i.e., cancel all pending asynchronous
|
||||||
|
tokens, flush transmission and receiving buffer directly without informing
|
||||||
|
the communication peer.
|
||||||
|
No other TCPv4 Protocol operation can be executed by this instance
|
||||||
|
until it is configured properly. For an active TCP4 instance, after a proper
|
||||||
|
configuration it may call Connect() to initiates the three-way handshake.
|
||||||
|
For a passive TCP4 instance, its state will transit to Tcp4StateListen after
|
||||||
|
configuration, and Accept() may be called to listen the incoming TCP connection
|
||||||
|
request. If TcpConfigData is set to NULL, the instance is reset. Resetting
|
||||||
|
process will be done brutally, the state machine will be set to Tcp4StateClosed
|
||||||
|
directly, the receive queue and transmit queue will be flushed, and no traffic is
|
||||||
|
allowed through this instance.
|
||||||
|
|
||||||
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
||||||
@param TcpConfigData Pointer to the configure data to configure the
|
@param TcpConfigData Pointer to the configure data to configure the
|
||||||
@ -136,8 +157,8 @@ Tcp4GetModeData (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
Tcp4Configure (
|
Tcp4Configure (
|
||||||
IN EFI_TCP4_PROTOCOL * This,
|
IN EFI_TCP4_PROTOCOL *This,
|
||||||
IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL
|
IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_TCP4_OPTION *Option;
|
EFI_TCP4_OPTION *Option;
|
||||||
@ -199,15 +220,35 @@ Tcp4Configure (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Add or delete routing entries.
|
Add or delete routing entries.
|
||||||
|
|
||||||
|
The Routes() function adds or deletes a route from the instance¡¯s routing table.
|
||||||
|
The most specific route is selected by comparing the SubnetAddress with the
|
||||||
|
destination IP address¡¯s arithmetical AND to the SubnetMask.
|
||||||
|
The default route is added with both SubnetAddress and SubnetMask set to 0.0.0.0.
|
||||||
|
The default route matches all destination IP addresses if there is no more specific route.
|
||||||
|
Direct route is added with GatewayAddress set to 0.0.0.0. Packets are sent to
|
||||||
|
the destination host if its address can be found in the Address Resolution Protocol (ARP)
|
||||||
|
cache or it is on the local subnet. If the instance is configured to use default
|
||||||
|
address, a direct route to the local network will be added automatically.
|
||||||
|
Each TCP instance has its own independent routing table. Instance that uses the
|
||||||
|
default IP address will have a copy of the EFI_IP4_CONFIG_PROTOCOL¡¯s routing table.
|
||||||
|
The copy will be updated automatically whenever the IP driver reconfigures its
|
||||||
|
instance. As a result, the previous modification to the instance¡¯s local copy
|
||||||
|
will be lost. The priority of checking the route table is specific with IP
|
||||||
|
implementation and every IP implementation must comply with RFC 1122.
|
||||||
|
|
||||||
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
||||||
@param DeleteRoute If TRUE, delete the specified route from routing
|
@param DeleteRoute If TRUE, delete the specified route from routing
|
||||||
table; if FALSE, add the specified route to
|
table; if FALSE, add the specified route to
|
||||||
routing table.
|
routing table.
|
||||||
|
DestinationAddress and SubnetMask are used as
|
||||||
|
the keywords to search route entry.
|
||||||
@param SubnetAddress The destination network.
|
@param SubnetAddress The destination network.
|
||||||
@param SubnetMask The subnet mask for the destination network.
|
@param SubnetMask The subnet mask for the destination network.
|
||||||
@param GatewayAddress The gateway address for this route.
|
@param GatewayAddress The gateway address for this route.
|
||||||
|
It must be on the same subnet with the station
|
||||||
|
address unless a direct route is specified.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The operation completed successfully.
|
@retval EFI_SUCCESS The operation completed successfully.
|
||||||
@retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been
|
@retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance has not been
|
||||||
configured.
|
configured.
|
||||||
@ -253,12 +294,22 @@ Tcp4Routes (
|
|||||||
/**
|
/**
|
||||||
Initiate a nonblocking TCP connection request for an active TCP instance.
|
Initiate a nonblocking TCP connection request for an active TCP instance.
|
||||||
|
|
||||||
|
The Connect() function will initiate an active open to the remote peer configured
|
||||||
|
in current TCP instance if it is configured active. If the connection succeeds
|
||||||
|
or fails due to any error, the ConnectionToken->CompletionToken.Event will be
|
||||||
|
signaled and ConnectionToken->CompletionToken.Status will be updated accordingly.
|
||||||
|
This function can only be called for the TCP instance in Tcp4StateClosed state.
|
||||||
|
The instance will transfer into Tcp4StateSynSent if the function returns EFI_SUCCESS.
|
||||||
|
If TCP three way handshake succeeds, its state will become Tcp4StateEstablished,
|
||||||
|
otherwise, the state will return to Tcp4StateClosed.
|
||||||
|
|
||||||
@param This Pointer to the EFI_TCP4_PROTOCOL instance
|
@param This Pointer to the EFI_TCP4_PROTOCOL instance
|
||||||
@param ConnectionToken Pointer to the connection token to return when
|
@param ConnectionToken Pointer to the connection token to return when
|
||||||
the TCP three way handshake finishes.
|
the TCP three way handshake finishes.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The connection request is successfully
|
@retval EFI_SUCCESS The connection request is successfully initiated
|
||||||
initiated.
|
and the state of this TCPv4 instance has
|
||||||
|
been changed to Tcp4StateSynSent.
|
||||||
@retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been
|
@retval EFI_NOT_STARTED This EFI_TCP4_PROTOCOL instance hasn't been
|
||||||
configured.
|
configured.
|
||||||
@retval EFI_ACCESS_DENIED The instance is not configured as an active one
|
@retval EFI_ACCESS_DENIED The instance is not configured as an active one
|
||||||
@ -293,6 +344,16 @@ Tcp4Connect (
|
|||||||
/**
|
/**
|
||||||
Listen on the passive instance to accept an incoming connection request.
|
Listen on the passive instance to accept an incoming connection request.
|
||||||
|
|
||||||
|
The Accept() function initiates an asynchronous accept request to wait for an
|
||||||
|
incoming connection on the passive TCP instance. If a remote peer successfully
|
||||||
|
establishes a connection with this instance, a new TCP instance will be created
|
||||||
|
and its handle will be returned in ListenToken->NewChildHandle. The newly created
|
||||||
|
instance is configured by inheriting the passive instance¡¯s configuration and is
|
||||||
|
ready for use upon return. The instance is in the Tcp4StateEstablished state.
|
||||||
|
The ListenToken->CompletionToken.Event will be signaled when a new connection
|
||||||
|
is accepted, user aborts the listen or connection is reset. This function only
|
||||||
|
can be called when current TCP instance is in Tcp4StateListen state.
|
||||||
|
|
||||||
@param This Pointer to the EFI_TCP4_PROTOCOL instance
|
@param This Pointer to the EFI_TCP4_PROTOCOL instance
|
||||||
@param ListenToken Pointer to the listen token to return when
|
@param ListenToken Pointer to the listen token to return when
|
||||||
operation finishes.
|
operation finishes.
|
||||||
@ -307,7 +368,7 @@ Tcp4Connect (
|
|||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
|
||||||
@retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish
|
@retval EFI_OUT_OF_RESOURCES Could not allocate enough resources to finish
|
||||||
the operation.
|
the operation.
|
||||||
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
@retval EFI_DEVICE_ERROR Any unexpected and not belonged to above category error.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -334,6 +395,10 @@ Tcp4Accept (
|
|||||||
/**
|
/**
|
||||||
Queues outgoing data into the transmit queue
|
Queues outgoing data into the transmit queue
|
||||||
|
|
||||||
|
The Transmit() function queues a sending request to this TCPv4 instance along
|
||||||
|
with the user data. The status of the token is updated and the event in the token
|
||||||
|
will be signaled once the data is sent out or some error occurs.
|
||||||
|
|
||||||
@param This Pointer to the EFI_TCP4_PROTOCOL instance
|
@param This Pointer to the EFI_TCP4_PROTOCOL instance
|
||||||
@param Token Pointer to the completion token to queue to the
|
@param Token Pointer to the completion token to queue to the
|
||||||
transmit queue
|
transmit queue
|
||||||
@ -346,12 +411,13 @@ Tcp4Accept (
|
|||||||
@retval EFI_INVALID_PARAMETER One or more parameters are invalid
|
@retval EFI_INVALID_PARAMETER One or more parameters are invalid
|
||||||
@retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
|
@retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
|
||||||
* A transmit completion token with the same
|
* A transmit completion token with the same
|
||||||
Token-> CompletionToken.Event was already in the
|
Token-> CompletionToken.Event was already in the
|
||||||
transmission queue. * The current instance is in
|
transmission queue.
|
||||||
Tcp4StateClosed state * The current instance is
|
* The current instance is in Tcp4StateClosed state
|
||||||
a passive one and it is in Tcp4StateListen
|
* The current instance is a passive one and
|
||||||
state. * User has called Close() to disconnect
|
it is in Tcp4StateListen state.
|
||||||
this connection.
|
* User has called Close() to disconnect this
|
||||||
|
connection.
|
||||||
@retval EFI_NOT_READY The completion token could not be queued because
|
@retval EFI_NOT_READY The completion token could not be queued because
|
||||||
the transmit queue is full.
|
the transmit queue is full.
|
||||||
@retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of
|
@retval EFI_OUT_OF_RESOURCES Could not queue the transmit data because of
|
||||||
@ -399,6 +465,18 @@ Tcp4Transmit (
|
|||||||
/**
|
/**
|
||||||
Place an asynchronous receive request into the receiving queue.
|
Place an asynchronous receive request into the receiving queue.
|
||||||
|
|
||||||
|
The Receive() function places a completion token into the receive packet queue.
|
||||||
|
This function is always asynchronous. The caller must allocate the
|
||||||
|
Token->CompletionToken.Event and the FragmentBuffer used to receive data. He also
|
||||||
|
must fill the DataLength which represents the whole length of all FragmentBuffer.
|
||||||
|
When the receive operation completes, the EFI TCPv4 Protocol driver updates the
|
||||||
|
Token->CompletionToken.Status and Token->Packet.RxData fields and the
|
||||||
|
Token->CompletionToken.Event is signaled. If got data the data and its length
|
||||||
|
will be copy into the FragmentTable, in the same time the full length of received
|
||||||
|
data will be recorded in the DataLength fields. Providing a proper notification
|
||||||
|
function and context for the event will enable the user to receive the notification
|
||||||
|
and receiving status. That notification function is guaranteed to not be re-entered.
|
||||||
|
|
||||||
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
||||||
@param Token Pointer to a token that is associated with the
|
@param Token Pointer to a token that is associated with the
|
||||||
receive data descriptor.
|
receive data descriptor.
|
||||||
@ -412,14 +490,17 @@ Tcp4Transmit (
|
|||||||
@retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued
|
@retval EFI_OUT_OF_RESOURCES The receive completion token could not be queued
|
||||||
due to a lack of system resources.
|
due to a lack of system resources.
|
||||||
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
@retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
||||||
|
The EFI TCPv4 Protocol instance has been reset
|
||||||
|
to startup defaults.
|
||||||
@retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
|
@retval EFI_ACCESS_DENIED One or more of the following conditions is TRUE:
|
||||||
* A receive completion token with the same
|
* A receive completion token with the same
|
||||||
Token->CompletionToken.Event was already in the
|
Token->CompletionToken.Event was already in
|
||||||
receive queue. * The current instance is in
|
the receive queue.
|
||||||
Tcp4StateClosed state. * The current instance is
|
* The current instance is in Tcp4StateClosed state.
|
||||||
a passive one and it is in Tcp4StateListen
|
* The current instance is a passive one and it
|
||||||
state. * User has called Close() to disconnect
|
is in Tcp4StateListen state.
|
||||||
this connection.
|
* User has called Close() to disconnect this
|
||||||
|
connection.
|
||||||
@retval EFI_CONNECTION_FIN The communication peer has closed the connection
|
@retval EFI_CONNECTION_FIN The communication peer has closed the connection
|
||||||
and there is no any buffered data in the receive
|
and there is no any buffered data in the receive
|
||||||
buffer of this instance.
|
buffer of this instance.
|
||||||
@ -466,6 +547,15 @@ Tcp4Receive (
|
|||||||
/**
|
/**
|
||||||
Disconnecting a TCP connection gracefully or reset a TCP connection.
|
Disconnecting a TCP connection gracefully or reset a TCP connection.
|
||||||
|
|
||||||
|
Initiate an asynchronous close token to TCP driver. After Close() is called,
|
||||||
|
any buffered transmission data will be sent by TCP driver and the current
|
||||||
|
instance will have a graceful close working flow described as RFC 793 if
|
||||||
|
AbortOnClose is set to FALSE, otherwise, a rest packet will be sent by TCP
|
||||||
|
driver to fast disconnect this connection. When the close operation completes
|
||||||
|
successfully the TCP instance is in Tcp4StateClosed state, all pending
|
||||||
|
asynchronous operation is signaled and any buffers used for TCP network traffic
|
||||||
|
is flushed.
|
||||||
|
|
||||||
@param This Pointer to the EFI_TCP4_PROTOCOL instance
|
@param This Pointer to the EFI_TCP4_PROTOCOL instance
|
||||||
@param CloseToken Pointer to the close token to return when
|
@param CloseToken Pointer to the close token to return when
|
||||||
operation finishes.
|
operation finishes.
|
||||||
@ -473,11 +563,11 @@ Tcp4Receive (
|
|||||||
@retval EFI_SUCCESS The operation completed successfully
|
@retval EFI_SUCCESS The operation completed successfully
|
||||||
@retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
|
@retval EFI_NOT_STARTED The EFI_TCP4_PROTOCOL instance hasn't been
|
||||||
configured.
|
configured.
|
||||||
@retval EFI_ACCESS_DENIED One or more of the following are TRUE: *
|
@retval EFI_ACCESS_DENIED One or more of the following are TRUE:
|
||||||
Configure() has been called with TcpConfigData
|
* Configure() has been called with TcpConfigData
|
||||||
set to NULL and this function has not returned.
|
set to NULL and this function has not returned.
|
||||||
* Previous Close() call on this instance has not
|
* Previous Close() call on this instance has not
|
||||||
finished.
|
finished.
|
||||||
@retval EFI_INVALID_PARAMETER One ore more parameters are invalid
|
@retval EFI_INVALID_PARAMETER One ore more parameters are invalid
|
||||||
@retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the
|
@retval EFI_OUT_OF_RESOURCES Could not allocate enough resource to finish the
|
||||||
operation
|
operation
|
||||||
@ -509,21 +599,38 @@ Tcp4Close (
|
|||||||
/**
|
/**
|
||||||
Abort an asynchronous connection, listen, transmission or receive request.
|
Abort an asynchronous connection, listen, transmission or receive request.
|
||||||
|
|
||||||
|
The Cancel() function aborts a pending connection, listen, transmit or receive
|
||||||
|
request. If Token is not NULL and the token is in the connection, listen,
|
||||||
|
transmission or receive queue when it is being cancelled, its Token->Status
|
||||||
|
will be set to EFI_ABORTED and then Token->Event will be signaled. If the token
|
||||||
|
is not in one of the queues, which usually means that the asynchronous operation
|
||||||
|
has completed, EFI_NOT_FOUND is returned. If Token is NULL all asynchronous token
|
||||||
|
issued by Connect(), Accept(), Transmit() and Receive()will be aborted.
|
||||||
|
|
||||||
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
||||||
@param Token Pointer to a token that has been issued by
|
@param Token Pointer to a token that has been issued by
|
||||||
Connect(), Accept(), Transmit() or Receive(). If
|
Connect(), Accept(), Transmit() or Receive(). If
|
||||||
NULL, all pending tokens issued by above four
|
NULL, all pending tokens issued by above four
|
||||||
functions will be aborted.
|
functions will be aborted.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED The operation is not supported in current
|
@retval EFI_SUCCESS The asynchronous I/O request is aborted and Token->Event
|
||||||
|
is signaled.
|
||||||
|
@retval EFI_INVALID_PARAMETER This is NULL.
|
||||||
|
@retval EFI_NOT_STARTED This instance hasn¡¯t been configured.
|
||||||
|
@retval EFI_NO_MAPPING When using the default address, configuration
|
||||||
|
(DHCP, BOOTP,RARP, etc.) hasn¡¯t finished yet.
|
||||||
|
@retval EFI_NOT_FOUND The asynchronous I/O request isn¡¯t found in the
|
||||||
|
transmission or receive queue. It has either
|
||||||
|
completed or wasn¡¯t issued by Transmit() and Receive().
|
||||||
|
@retval EFI_UNSUPPORTED The operation is not supported in current
|
||||||
implementation.
|
implementation.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
Tcp4Cancel (
|
Tcp4Cancel (
|
||||||
IN EFI_TCP4_PROTOCOL * This,
|
IN EFI_TCP4_PROTOCOL *This,
|
||||||
IN EFI_TCP4_COMPLETION_TOKEN * Token OPTIONAL
|
IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
@ -533,6 +640,13 @@ Tcp4Cancel (
|
|||||||
/**
|
/**
|
||||||
Poll to receive incoming data and transmit outgoing segments.
|
Poll to receive incoming data and transmit outgoing segments.
|
||||||
|
|
||||||
|
The Poll() function increases the rate that data is moved between the network
|
||||||
|
and application and can be called when the TCP instance is created successfully.
|
||||||
|
Its use is optional. In some implementations, the periodical timer in the MNP
|
||||||
|
driver may not poll the underlying communications device fast enough to avoid
|
||||||
|
drop packets. Drivers and applications that are experiencing packet loss should
|
||||||
|
try calling the Poll() function in a high frequency.
|
||||||
|
|
||||||
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
@param This Pointer to the EFI_TCP4_PROTOCOL instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Incoming or outgoing data was processed.
|
@retval EFI_SUCCESS Incoming or outgoing data was processed.
|
||||||
|
@ -64,12 +64,12 @@ typedef struct _TCP4_ROUTE_INFO {
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
Tcp4GetModeData (
|
Tcp4GetModeData (
|
||||||
IN CONST EFI_TCP4_PROTOCOL * This,
|
IN CONST EFI_TCP4_PROTOCOL *This,
|
||||||
OUT EFI_TCP4_CONNECTION_STATE * Tcp4State OPTIONAL,
|
OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL,
|
||||||
OUT EFI_TCP4_CONFIG_DATA * Tcp4ConfigData OPTIONAL,
|
OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL,
|
||||||
OUT EFI_IP4_MODE_DATA * Ip4ModeData OPTIONAL,
|
OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL,
|
||||||
OUT EFI_MANAGED_NETWORK_CONFIG_DATA * MnpConfigData OPTIONAL,
|
OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
|
||||||
OUT EFI_SIMPLE_NETWORK_MODE * SnpModeData OPTIONAL
|
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -78,8 +78,8 @@ Tcp4GetModeData (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
Tcp4Configure (
|
Tcp4Configure (
|
||||||
IN EFI_TCP4_PROTOCOL * This,
|
IN EFI_TCP4_PROTOCOL *This,
|
||||||
IN EFI_TCP4_CONFIG_DATA * TcpConfigData OPTIONAL
|
IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -133,6 +133,7 @@ Tcp4Transmit (
|
|||||||
// through this TCP instance
|
// through this TCP instance
|
||||||
//
|
//
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
Tcp4Receive (
|
Tcp4Receive (
|
||||||
IN EFI_TCP4_PROTOCOL *This,
|
IN EFI_TCP4_PROTOCOL *This,
|
||||||
IN EFI_TCP4_IO_TOKEN *Token
|
IN EFI_TCP4_IO_TOKEN *Token
|
||||||
@ -155,8 +156,8 @@ Tcp4Close (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
Tcp4Cancel (
|
Tcp4Cancel (
|
||||||
IN EFI_TCP4_PROTOCOL * This,
|
IN EFI_TCP4_PROTOCOL *This,
|
||||||
IN EFI_TCP4_COMPLETION_TOKEN * Token OPTIONAL
|
IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -477,7 +477,7 @@ TcpGetIss (
|
|||||||
/**
|
/**
|
||||||
Get the local mss.
|
Get the local mss.
|
||||||
|
|
||||||
None
|
@param Sock Pointer to the socket to get mss
|
||||||
|
|
||||||
@return The mss size.
|
@return The mss size.
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ typedef struct s_TCP_OPTION {
|
|||||||
UINT32 TSEcr; // the TSEcr field in a timestamp option
|
UINT32 TSEcr; // the TSEcr field in a timestamp option
|
||||||
} TCP_OPTION;
|
} TCP_OPTION;
|
||||||
|
|
||||||
enum {
|
typedef enum {
|
||||||
|
|
||||||
//
|
//
|
||||||
// supported TCP option type and their length
|
// supported TCP option type and their length
|
||||||
@ -68,12 +68,12 @@ enum {
|
|||||||
//
|
//
|
||||||
// Other misc definations
|
// Other misc definations
|
||||||
//
|
//
|
||||||
TCP_OPTION_MAX_WS = 14, // Maxium window scale value
|
|
||||||
TCP_OPTION_MAX_WIN = 0xffff, // max window size in TCP header
|
|
||||||
TCP_OPTION_RCVD_MSS = 0x01,
|
TCP_OPTION_RCVD_MSS = 0x01,
|
||||||
TCP_OPTION_RCVD_WS = 0x02,
|
TCP_OPTION_RCVD_WS = 0x02,
|
||||||
TCP_OPTION_RCVD_TS = 0x04
|
TCP_OPTION_RCVD_TS = 0x04,
|
||||||
};
|
TCP_OPTION_MAX_WS = 14, // Maxium window scale value
|
||||||
|
TCP_OPTION_MAX_WIN = 0xffff // max window size in TCP header
|
||||||
|
} TCP_OPTION_TYPE;
|
||||||
|
|
||||||
UINT8
|
UINT8
|
||||||
TcpComputeScale (
|
TcpComputeScale (
|
||||||
|
@ -235,7 +235,7 @@ TcpDataToSend (
|
|||||||
Len = Tcb->SndMss;
|
Len = Tcb->SndMss;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Force || (Len == 0 && Left == 0)) {
|
if ((Force != 0)|| (Len == 0 && Left == 0)) {
|
||||||
return Len;
|
return Len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,7 +528,7 @@ TcpGetSegmentSndQue (
|
|||||||
//
|
//
|
||||||
// copy data to the segment
|
// copy data to the segment
|
||||||
//
|
//
|
||||||
if (CopyLen) {
|
if (CopyLen != 0) {
|
||||||
Data = NetbufAllocSpace (Nbuf, CopyLen, NET_BUF_TAIL);
|
Data = NetbufAllocSpace (Nbuf, CopyLen, NET_BUF_TAIL);
|
||||||
ASSERT (Data);
|
ASSERT (Data);
|
||||||
|
|
||||||
@ -587,7 +587,7 @@ TcpGetSegmentSock (
|
|||||||
|
|
||||||
DataGet = 0;
|
DataGet = 0;
|
||||||
|
|
||||||
if (Len) {
|
if (Len != 0) {
|
||||||
//
|
//
|
||||||
// copy data to the segment.
|
// copy data to the segment.
|
||||||
//
|
//
|
||||||
@ -762,7 +762,7 @@ SEND_AGAIN:
|
|||||||
|
|
||||||
Flag = mTcpOutFlag[Tcb->State];
|
Flag = mTcpOutFlag[Tcb->State];
|
||||||
|
|
||||||
if (Flag & TCP_FLG_SYN) {
|
if ((Flag & TCP_FLG_SYN) != 0) {
|
||||||
|
|
||||||
Seq = Tcb->Iss;
|
Seq = Tcb->Iss;
|
||||||
Len = 0;
|
Len = 0;
|
||||||
@ -772,7 +772,8 @@ SEND_AGAIN:
|
|||||||
// only send a segment without data if SYN or
|
// only send a segment without data if SYN or
|
||||||
// FIN is set.
|
// FIN is set.
|
||||||
//
|
//
|
||||||
if ((Len == 0) && !(Flag & (TCP_FLG_SYN | TCP_FLG_FIN))) {
|
if ((Len == 0) &&
|
||||||
|
((Flag & (TCP_FLG_SYN | TCP_FLG_FIN)) == 0)) {
|
||||||
return Sent;
|
return Sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -799,7 +800,7 @@ SEND_AGAIN:
|
|||||||
End++;
|
End++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flag & TCP_FLG_FIN) {
|
if ((Flag & TCP_FLG_FIN) != 0) {
|
||||||
//
|
//
|
||||||
// Send FIN if all data is sent, and FIN is
|
// Send FIN if all data is sent, and FIN is
|
||||||
// in the window
|
// in the window
|
||||||
@ -843,7 +844,7 @@ SEND_AGAIN:
|
|||||||
NetbufTrim (Nbuf, (Nbuf->Tcp->HeadLen << 2), NET_BUF_HEAD);
|
NetbufTrim (Nbuf, (Nbuf->Tcp->HeadLen << 2), NET_BUF_HEAD);
|
||||||
Nbuf->Tcp = NULL;
|
Nbuf->Tcp = NULL;
|
||||||
|
|
||||||
if (Flag & TCP_FLG_FIN) {
|
if ((Flag & TCP_FLG_FIN) != 0) {
|
||||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT);
|
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -867,7 +868,7 @@ SEND_AGAIN:
|
|||||||
//
|
//
|
||||||
Tcb->DelayedAck = 0;
|
Tcb->DelayedAck = 0;
|
||||||
|
|
||||||
if (Flag & TCP_FLG_FIN) {
|
if ((Flag & TCP_FLG_FIN) != 0) {
|
||||||
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT);
|
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_FIN_SENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ typedef struct _TCP_CB TCP_CB;
|
|||||||
// tcp states, Don't change their order, it is used as
|
// tcp states, Don't change their order, it is used as
|
||||||
// index to mTcpOutFlag and other macros
|
// index to mTcpOutFlag and other macros
|
||||||
//
|
//
|
||||||
enum {
|
typedef enum {
|
||||||
TCP_CLOSED = 0,
|
TCP_CLOSED = 0,
|
||||||
TCP_LISTEN,
|
TCP_LISTEN,
|
||||||
TCP_SYN_SENT,
|
TCP_SYN_SENT,
|
||||||
@ -43,12 +43,12 @@ enum {
|
|||||||
TCP_TIME_WAIT,
|
TCP_TIME_WAIT,
|
||||||
TCP_CLOSE_WAIT,
|
TCP_CLOSE_WAIT,
|
||||||
TCP_LAST_ACK
|
TCP_LAST_ACK
|
||||||
};
|
} TCP_STATES;
|
||||||
|
|
||||||
//
|
//
|
||||||
// flags in the TCP header
|
// flags in the TCP header
|
||||||
//
|
//
|
||||||
enum {
|
typedef enum {
|
||||||
|
|
||||||
TCP_FLG_FIN = 0x01,
|
TCP_FLG_FIN = 0x01,
|
||||||
TCP_FLG_SYN = 0x02,
|
TCP_FLG_SYN = 0x02,
|
||||||
@ -57,9 +57,9 @@ enum {
|
|||||||
TCP_FLG_ACK = 0x10,
|
TCP_FLG_ACK = 0x10,
|
||||||
TCP_FLG_URG = 0x20,
|
TCP_FLG_URG = 0x20,
|
||||||
TCP_FLG_FLAG = 0x3F // mask for all the flags
|
TCP_FLG_FLAG = 0x3F // mask for all the flags
|
||||||
};
|
} TCP_HEADER_FLAG;
|
||||||
|
|
||||||
enum {
|
typedef enum {
|
||||||
|
|
||||||
//
|
//
|
||||||
// TCP error status
|
// TCP error status
|
||||||
@ -145,7 +145,7 @@ enum {
|
|||||||
TCP_KEEPALIVE_PERIOD_MIN= TCP_TICK_HZ *30,
|
TCP_KEEPALIVE_PERIOD_MIN= TCP_TICK_HZ *30,
|
||||||
TCP_FIN_WAIT2_TIME_MAX = 4 *TCP_TICK_HZ,
|
TCP_FIN_WAIT2_TIME_MAX = 4 *TCP_TICK_HZ,
|
||||||
TCP_TIME_WAIT_TIME_MAX = 60 *TCP_TICK_HZ
|
TCP_TIME_WAIT_TIME_MAX = 60 *TCP_TICK_HZ
|
||||||
};
|
} TCP_MISC_VALUES;
|
||||||
|
|
||||||
typedef struct _TCP_SEG {
|
typedef struct _TCP_SEG {
|
||||||
TCP_SEQNO Seq; // Starting sequence number
|
TCP_SEQNO Seq; // Starting sequence number
|
||||||
|
@ -461,7 +461,7 @@ TcpBackoffRto (
|
|||||||
// may be wrong, fold it. So the next time a valid
|
// may be wrong, fold it. So the next time a valid
|
||||||
// measurement is sampled, we can start fresh.
|
// measurement is sampled, we can start fresh.
|
||||||
//
|
//
|
||||||
if ((Tcb->LossTimes >= TCP_FOLD_RTT) && Tcb->SRtt) {
|
if ((Tcb->LossTimes >= TCP_FOLD_RTT) && (Tcb->SRtt != 0)) {
|
||||||
Tcb->RttVar += Tcb->SRtt >> 2;
|
Tcb->RttVar += Tcb->SRtt >> 2;
|
||||||
Tcb->SRtt = 0;
|
Tcb->SRtt = 0;
|
||||||
}
|
}
|
||||||
@ -521,7 +521,7 @@ TcpTickingDpc (
|
|||||||
|
|
||||||
Tcb->Idle++;
|
Tcb->Idle++;
|
||||||
|
|
||||||
if (Tcb->DelayedAck) {
|
if (Tcb->DelayedAck != 0) {
|
||||||
TcpSendAck (Tcb);
|
TcpSendAck (Tcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user