Fixing function headers.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7114 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
niry 2008-12-24 08:14:19 +00:00
parent 0c323d071d
commit 276dcc1b14
12 changed files with 100 additions and 95 deletions

View File

@ -83,7 +83,6 @@ SockTcpDataToRcv (
UINT32 DataLen; UINT32 DataLen;
TCP_RSV_DATA *TcpRsvData; TCP_RSV_DATA *TcpRsvData;
BOOLEAN Urg; BOOLEAN Urg;
ASSERT ((SockBuffer != NULL) && (IsUrg != NULL) && (BufLen > 0)); ASSERT ((SockBuffer != NULL) && (IsUrg != NULL) && (BufLen > 0));
RcvBufEntry = SockBufFirst (SockBuffer); RcvBufEntry = SockBufFirst (SockBuffer);
@ -232,7 +231,6 @@ SockProcessRcvToken (
SockSetTcpRxData (Sock, RxData, TokenRcvdBytes, IsUrg); SockSetTcpRxData (Sock, RxData, TokenRcvdBytes, IsUrg);
NetbufQueTrim (Sock->RcvBuffer.DataQueue, TokenRcvdBytes); NetbufQueTrim (Sock->RcvBuffer.DataQueue, TokenRcvdBytes);
// SOCK_TRIM_RCV_BUFF (Sock, TokenRcvdBytes);
SIGNAL_TOKEN (&(RcvToken->Token), EFI_SUCCESS); SIGNAL_TOKEN (&(RcvToken->Token), EFI_SUCCESS);
return TokenRcvdBytes; return TokenRcvdBytes;
@ -545,7 +543,7 @@ OnError:
@param SockInitData Pointer to the initial data of the socket. @param SockInitData Pointer to the initial data of the socket.
@return Pointer to the newly created socket. @return Pointer to the newly created socket, return NULL when exception occured.
**/ **/
SOCKET * SOCKET *
@ -934,7 +932,9 @@ SockClone (
/** /**
Called by the low layer protocol to indicate the socket a connection is Called by the low layer protocol to indicate the socket a connection is
established. This function just changes the socket's state to SO_CONNECTED established.
This function just changes the socket's state to SO_CONNECTED
and signals the token used for connection establishment. and signals the token used for connection establishment.
@param Sock Pointer to the socket associated with the @param Sock Pointer to the socket associated with the
@ -961,12 +961,14 @@ SockConnEstablished (
/** /**
Called by the low layer protocol to indicate the connection is closed; This Called by the low layer protocol to indicate the connection is closed.
function flushes the socket, sets the state to SO_CLOSED and signals the close
token. This function flushes the socket, sets the state to SO_CLOSED and signals
the close token.
@param Sock Pointer to the socket associated with the closed @param Sock Pointer to the socket associated with the closed
connection. connection.
**/ **/
VOID VOID
SockConnClosed ( SockConnClosed (
@ -989,7 +991,8 @@ SockConnClosed (
/** /**
Called by low layer protocol to indicate that some data is sent or processed; Called by low layer protocol to indicate that some data is sent or processed.
This function trims the sent data in the socket send buffer, signals the data This function trims the sent data in the socket send buffer, signals the data
token if proper. token if proper.
@ -1078,7 +1081,8 @@ SockGetDataToSend (
/** /**
Called by the low layer protocol to deliver received data to socket layer; Called by the low layer protocol to deliver received data to socket layer.
This function will append the data to the socket receive buffer, set ther This function will append the data to the socket receive buffer, set ther
urgent data length and then check if any receive token can be signaled. urgent data length and then check if any receive token can be signaled.
@ -1184,11 +1188,11 @@ SockRcvdErr (
/** /**
Called by the low layer protocol to indicate that there Called by the low layer protocol to indicate that there will be no more data
will be no more data from the communication peer; This from the communication peer.
function set the socket's state to SO_NO_MORE_DATA and
signal all queued IO tokens with the error status This function set the socket's state to SO_NO_MORE_DATA and signal all queued
EFI_CONNECTION_FIN. IO tokens with the error status EFI_CONNECTION_FIN.
@param Sock Pointer to the socket. @param Sock Pointer to the socket.

View File

@ -857,7 +857,7 @@ Exit:
EFI_STATUS EFI_STATUS
SockGetMode ( SockGetMode (
IN SOCKET *Sock, IN SOCKET *Sock,
IN VOID *Mode IN OUT VOID *Mode
) )
{ {
return Sock->ProtoHandler (Sock, SOCK_MODE, Mode); return Sock->ProtoHandler (Sock, SOCK_MODE, Mode);

View File

@ -114,7 +114,7 @@ typedef enum {
#define SOCK_IS_NO_MORE_DATA(Sock) (0 != ((Sock)->Flag & SO_NO_MORE_DATA)) #define SOCK_IS_NO_MORE_DATA(Sock) (0 != ((Sock)->Flag & SO_NO_MORE_DATA))
#define SOCK_SIGNATURE SIGNATURE_32 ('S', 'O', 'C', 'K') #define SOCK_SIGNATURE EFI_SIGNATURE_32 ('S', 'O', 'C', 'K')
#define SOCK_FROM_THIS(a) CR ((a), SOCKET, NetProtocol, SOCK_SIGNATURE) #define SOCK_FROM_THIS(a) CR ((a), SOCKET, NetProtocol, SOCK_SIGNATURE)
@ -197,17 +197,6 @@ typedef enum {
SOCK_STREAM ///< This socket providing stream service SOCK_STREAM ///< This socket providing stream service
} SOCK_TYPE; } SOCK_TYPE;
///
/// The handler of protocol for request from socket.
///
typedef
EFI_STATUS
(*SOCK_PROTO_HANDLER) (
IN SOCKET *Socket, ///< The socket issuing the request to protocol
IN SOCK_REQUEST Request, ///< The request issued by socket
IN VOID *RequestData ///< The request related data
);
/// ///
/// The buffer structure of rcvd data and send data used by socket. /// The buffer structure of rcvd data and send data used by socket.
/// ///
@ -217,6 +206,26 @@ typedef struct _SOCK_BUFFER {
NET_BUF_QUEUE *DataQueue; ///< The queue to buffer data NET_BUF_QUEUE *DataQueue; ///< The queue to buffer data
} SOCK_BUFFER; } SOCK_BUFFER;
/**
The handler of protocol for request from socket.
@param Socket The socket issuing the request to protocol
@param Request The request issued by socket
@param RequestData The request related data
@retval EFI_SUCCESS The socket request is completed successfully.
@retval other The error status returned by the corresponding TCP
layer function.
**/
typedef
EFI_STATUS
(*SOCK_PROTO_HANDLER) (
IN SOCKET *Socket,
IN SOCK_REQUEST Request,
IN VOID *RequestData
);
// //
// Socket provided oprerations for low layer protocol // Socket provided oprerations for low layer protocol
@ -241,7 +250,9 @@ SockSetState (
/** /**
Called by the low layer protocol to indicate the socket a connection is Called by the low layer protocol to indicate the socket a connection is
established. This function just changes the socket's state to SO_CONNECTED established.
This function just changes the socket's state to SO_CONNECTED
and signals the token used for connection establishment. and signals the token used for connection establishment.
@param Sock Pointer to the socket associated with the @param Sock Pointer to the socket associated with the
@ -254,9 +265,10 @@ SockConnEstablished (
); );
/** /**
Called by the low layer protocol to indicate the connection is closed; This Called by the low layer protocol to indicate the connection is closed.
function flushes the socket, sets the state to SO_CLOSED and signals the close
token. This function flushes the socket, sets the state to SO_CLOSED and signals
the close token.
@param Sock Pointer to the socket associated with the closed @param Sock Pointer to the socket associated with the closed
connection. connection.
@ -268,7 +280,8 @@ SockConnClosed (
); );
/** /**
Called by low layer protocol to indicate that some data is sent or processed; Called by low layer protocol to indicate that some data is sent or processed.
This function trims the sent data in the socket send buffer, signals the data This function trims the sent data in the socket send buffer, signals the data
token if proper. token if proper.
@ -305,10 +318,10 @@ SockGetDataToSend (
/** /**
Called by the low layer protocol to indicate that there Called by the low layer protocol to indicate that there
will be no more data from the communication peer; This will be no more data from the communication peer.
function set the socket's state to SO_NO_MORE_DATA and
signal all queued IO tokens with the error status This function set the socket's state to SO_NO_MORE_DATA and
EFI_CONNECTION_FIN. signal all queued IO tokens with the error status EFI_CONNECTION_FIN.
@param Sock Pointer to the socket. @param Sock Pointer to the socket.
@ -319,7 +332,8 @@ SockNoMoreData (
); );
/** /**
Called by the low layer protocol to deliver received data to socket layer; Called by the low layer protocol to deliver received data to socket layer.
This function will append the data to the socket receive buffer, set ther This function will append the data to the socket receive buffer, set ther
urgent data length and then check if any receive token can be signaled. urgent data length and then check if any receive token can be signaled.
@ -721,7 +735,7 @@ SockClose (
EFI_STATUS EFI_STATUS
SockGetMode ( SockGetMode (
IN SOCKET *Sock, IN SOCKET *Sock,
IN VOID *Mode IN OUT VOID *Mode
); );
/** /**

View File

@ -70,7 +70,7 @@ Tcp4Route (
EFI_STATUS EFI_STATUS
Tcp4GetMode ( Tcp4GetMode (
IN TCP_CB *Tcb, IN TCP_CB *Tcb,
IN TCP4_MODE_DATA *Mode IN OUT TCP4_MODE_DATA *Mode
) )
{ {
SOCKET *Sock; SOCKET *Sock;

View File

@ -630,7 +630,7 @@ EFI_STATUS
EFIAPI EFIAPI
Tcp4ServiceBindingCreateChild ( Tcp4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle IN OUT EFI_HANDLE *ChildHandle
) )
{ {
SOCKET *Sock; SOCKET *Sock;

View File

@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/ServiceBinding.h> #include <Protocol/ServiceBinding.h>
#include <Library/IpIoLib.h> #include <Library/IpIoLib.h>
#define TCP4_DRIVER_SIGNATURE SIGNATURE_32 ('T', 'C', 'P', '4') #define TCP4_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('T', 'C', 'P', '4')
#define TCP4_PORT_KNOWN 1024 #define TCP4_PORT_KNOWN 1024
#define TCP4_PORT_USER_RESERVED 65535 #define TCP4_PORT_USER_RESERVED 65535
@ -30,11 +30,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
TCP4_DRIVER_SIGNATURE \ TCP4_DRIVER_SIGNATURE \
) )
///
/// TCP heartbeat tick timer.
///
typedef struct _TCP4_HEARTBEAT_TIMER { typedef struct _TCP4_HEARTBEAT_TIMER {
EFI_EVENT TimerEvent; EFI_EVENT TimerEvent; ///< The event assoiated with the timer
INTN RefCnt; INTN RefCnt; ///< Number of reference
} TCP4_HEARTBEAT_TIMER; } TCP4_HEARTBEAT_TIMER;
///
/// TCP service data
///
typedef struct _TCP4_SERVICE_DATA { typedef struct _TCP4_SERVICE_DATA {
UINT32 Signature; UINT32 Signature;
EFI_HANDLE ControllerHandle; EFI_HANDLE ControllerHandle;
@ -45,6 +51,13 @@ typedef struct _TCP4_SERVICE_DATA {
LIST_ENTRY SocketList; LIST_ENTRY SocketList;
} TCP4_SERVICE_DATA; } TCP4_SERVICE_DATA;
///
/// TCP protocol data
///
typedef struct _TCP4_PROTO_DATA {
TCP4_SERVICE_DATA *TcpService;
TCP_CB *TcpPcb;
} TCP4_PROTO_DATA;
/** /**
@ -112,10 +125,6 @@ Tcp4Dispatcher (
IN VOID *Data OPTIONAL IN VOID *Data OPTIONAL
); );
typedef struct _TCP4_PROTO_DATA {
TCP4_SERVICE_DATA *TcpService;
TCP_CB *TcpPcb;
} TCP4_PROTO_DATA;
/** /**
The entry point for Tcp4 driver, used to install Tcp4 driver on the ImageHandle. The entry point for Tcp4 driver, used to install Tcp4 driver on the ImageHandle.
@ -300,7 +309,7 @@ EFI_STATUS
EFIAPI EFIAPI
Tcp4ServiceBindingCreateChild ( Tcp4ServiceBindingCreateChild (
IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_SERVICE_BINDING_PROTOCOL *This,
IN EFI_HANDLE *ChildHandle IN OUT EFI_HANDLE *ChildHandle
); );
/** /**

View File

@ -149,7 +149,7 @@ TcpGetRcvMss (
VOID VOID
TcpSetState ( TcpSetState (
IN TCP_CB *Tcb, IN TCP_CB *Tcb,
IN TCP_STATES State IN UINT8 State
); );
// //
@ -518,10 +518,8 @@ TcpComputeRtt (
@param Tcb Pointer to the TCP_CB of this TCP instance. @param Tcb Pointer to the TCP_CB of this TCP instance.
@param Nbuf Pointer to the NET_BUF containing the received tcp segment. @param Nbuf Pointer to the NET_BUF containing the received tcp segment.
@return 0 The data is trimmed.
**/ **/
INTN VOID
TcpTrimInWnd ( TcpTrimInWnd (
IN TCP_CB *Tcb, IN TCP_CB *Tcb,
IN NET_BUF *Nbuf IN NET_BUF *Nbuf
@ -608,7 +606,7 @@ TcpOnAppConnect (
@param Tcb Pointer to the TCP_CB of this TCP instance. @param Tcb Pointer to the TCP_CB of this TCP instance.
**/ **/
INTN VOID
TcpOnAppConsume ( TcpOnAppConsume (
IN TCP_CB *Tcb IN TCP_CB *Tcb
); );

View File

@ -257,10 +257,8 @@ TcpComputeRtt (
@param Left The sequence number of the window's left edge. @param Left The sequence number of the window's left edge.
@param Right The sequence number of the window's right edge. @param Right The sequence number of the window's right edge.
@return 0 The data is successfully trimmed.
**/ **/
INTN VOID
TcpTrimSegment ( TcpTrimSegment (
IN NET_BUF *Nbuf, IN NET_BUF *Nbuf,
IN TCP_SEQNO Left, IN TCP_SEQNO Left,
@ -284,7 +282,6 @@ TcpTrimSegment (
Seg->Seq = Seg->End; Seg->Seq = Seg->End;
NetbufTrim (Nbuf, Nbuf->TotalSize, NET_BUF_HEAD); NetbufTrim (Nbuf, Nbuf->TotalSize, NET_BUF_HEAD);
return 0;
} }
// //
@ -338,7 +335,6 @@ TcpTrimSegment (
} }
ASSERT (TcpVerifySegment (Nbuf) != 0); ASSERT (TcpVerifySegment (Nbuf) != 0);
return 0;
} }
@ -348,16 +344,14 @@ TcpTrimSegment (
@param Tcb Pointer to the TCP_CB of this TCP instance. @param Tcb Pointer to the TCP_CB of this TCP instance.
@param Nbuf Pointer to the NET_BUF containing the received tcp segment. @param Nbuf Pointer to the NET_BUF containing the received tcp segment.
@return 0 The data is trimmed.
**/ **/
INTN VOID
TcpTrimInWnd ( TcpTrimInWnd (
IN TCP_CB *Tcb, IN TCP_CB *Tcb,
IN NET_BUF *Nbuf IN NET_BUF *Nbuf
) )
{ {
return TcpTrimSegment (Nbuf, Tcb->RcvNxt, Tcb->RcvWl2 + Tcb->RcvWnd); TcpTrimSegment (Nbuf, Tcb->RcvNxt, Tcb->RcvWl2 + Tcb->RcvWnd);
} }
@ -1272,8 +1266,6 @@ NO_UPDATE:
TcpClose (Tcb); TcpClose (Tcb);
} }
break; break;
default:
break;
} }
// //

View File

@ -99,7 +99,7 @@ TcpInitTcbPeer (
{ {
UINT16 RcvMss; UINT16 RcvMss;
ASSERT (Tcb && Seg && Opt); ASSERT ((Tcb != NULL) && (Seg != NULL) && (Opt != NULL));
ASSERT (TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN)); ASSERT (TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN));
Tcb->SndWnd = Seg->Wnd; Tcb->SndWnd = Seg->Wnd;
@ -497,7 +497,7 @@ TcpGetRcvMss (
VOID VOID
TcpSetState ( TcpSetState (
IN TCP_CB *Tcb, IN TCP_CB *Tcb,
IN TCP_STATES State IN UINT8 State
) )
{ {
DEBUG ( DEBUG (
@ -508,7 +508,7 @@ TcpSetState (
mTcpStateName[State]) mTcpStateName[State])
); );
Tcb->State = (TCP_STATES)State; Tcb->State = State;
switch (State) { switch (State) {
case TCP_ESTABLISHED: case TCP_ESTABLISHED:
@ -791,7 +791,7 @@ TcpOnAppSend (
@param Tcb Pointer to the TCP_CB of this TCP instance. @param Tcb Pointer to the TCP_CB of this TCP instance.
**/ **/
INTN VOID
TcpOnAppConsume ( TcpOnAppConsume (
IN TCP_CB *Tcb IN TCP_CB *Tcb
) )
@ -800,17 +800,14 @@ TcpOnAppConsume (
switch (Tcb->State) { switch (Tcb->State) {
case TCP_CLOSED: case TCP_CLOSED:
return -1; return;
break;
case TCP_LISTEN: case TCP_LISTEN:
return -1; return;
break;
case TCP_SYN_SENT: case TCP_SYN_SENT:
case TCP_SYN_RCVD: case TCP_SYN_RCVD:
return 0; return;
break;
case TCP_ESTABLISHED: case TCP_ESTABLISHED:
TcpOld = TcpRcvWinOld (Tcb); TcpOld = TcpRcvWinOld (Tcb);
@ -834,19 +831,15 @@ TcpOnAppConsume (
break; break;
case TCP_CLOSE_WAIT: case TCP_CLOSE_WAIT:
return 0; return;
break;
case TCP_FIN_WAIT_1: case TCP_FIN_WAIT_1:
case TCP_FIN_WAIT_2: case TCP_FIN_WAIT_2:
case TCP_CLOSING: case TCP_CLOSING:
case TCP_LAST_ACK: case TCP_LAST_ACK:
case TCP_TIME_WAIT: case TCP_TIME_WAIT:
return -1; return;
break;
} }
return -1;
} }
@ -873,8 +866,6 @@ TcpOnAppAbort (
case TCP_CLOSE_WAIT: case TCP_CLOSE_WAIT:
TcpResetConnection (Tcb); TcpResetConnection (Tcb);
break; break;
default:
break;
} }
TcpSetState (Tcb, TCP_CLOSED); TcpSetState (Tcb, TCP_CLOSED);

View File

@ -832,9 +832,6 @@ SEND_AGAIN:
} }
if (TcpTransmitSegment (Tcb, Nbuf) != 0) { if (TcpTransmitSegment (Tcb, Nbuf) != 0) {
//
// TODO: double check this
//
NetbufTrim (Nbuf, (Nbuf->Tcp->HeadLen << 2), NET_BUF_HEAD); NetbufTrim (Nbuf, (Nbuf->Tcp->HeadLen << 2), NET_BUF_HEAD);
Nbuf->Tcp = NULL; Nbuf->Tcp = NULL;

View File

@ -182,7 +182,7 @@ struct _TCP_CB {
// //
// RFC793 and RFC1122 defined variables // RFC793 and RFC1122 defined variables
// //
TCP_STATES State; ///< TCP state, such as SYN_SENT, LISTEN UINT8 State; ///< TCP state, such as SYN_SENT, LISTEN
UINT8 DelayedAck; ///< Number of delayed ACKs UINT8 DelayedAck; ///< Number of delayed ACKs
UINT16 HeadSum; ///< Checksum of the fixed parts of pesudo UINT16 HeadSum; ///< Checksum of the fixed parts of pesudo
///< header: Src IP, Dst IP, 0, Protocol, ///< header: Src IP, Dst IP, 0, Protocol,

View File

@ -211,7 +211,7 @@ TcpProbeTimeout (
// //
if ((TcpDataToSend (Tcb, 1) != 0) && (TcpToSendData (Tcb, 1) > 0)) { if ((TcpDataToSend (Tcb, 1) != 0) && (TcpToSendData (Tcb, 1) > 0)) {
ASSERT (TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_REXMIT)); ASSERT (TCP_TIMER_ON (Tcb->EnabledTimer, TCP_TIMER_REXMIT) != 0);
return ; return ;
} }