2007-09-30 05:08:02 +02:00
|
|
|
/** @file
|
|
|
|
|
2008-12-16 03:57:53 +01:00
|
|
|
Copyright (c) 2005 - 2006, Intel Corporation<BR>
|
2007-09-30 05:08:02 +02:00
|
|
|
All rights reserved. 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
|
2008-12-16 03:57:53 +01:00
|
|
|
http://opensource.org/licenses/bsd-license.php<BR>
|
2007-09-30 05:08:02 +02:00
|
|
|
|
|
|
|
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 _SOCK_IMPL_H_
|
|
|
|
#define _SOCK_IMPL_H_
|
|
|
|
|
|
|
|
#include "Socket.h"
|
|
|
|
|
2008-12-16 03:57:53 +01:00
|
|
|
/**
|
|
|
|
Signal a event with the given status.
|
|
|
|
|
|
|
|
@param Token The token's event is to be signaled.
|
|
|
|
@param TokenStatus The status to be sent with the event.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
#define SIGNAL_TOKEN(Token, TokenStatus) \
|
|
|
|
do { \
|
|
|
|
(Token)->Status = (TokenStatus); \
|
|
|
|
gBS->SignalEvent ((Token)->Event); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
2008-12-16 03:57:53 +01:00
|
|
|
/**
|
|
|
|
Supporting function for both SockImpl and SockInterface.
|
|
|
|
|
|
|
|
@param Event The Event this notify function registered to, ignored.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
VOID
|
|
|
|
SockFreeFoo (
|
|
|
|
IN EFI_EVENT Event
|
|
|
|
);
|
|
|
|
|
2008-12-16 03:57:53 +01:00
|
|
|
/**
|
|
|
|
Process the TCP send data, buffer the tcp txdata and append
|
|
|
|
the buffer to socket send buffer,then try to send it.
|
|
|
|
|
|
|
|
@param Sock Pointer to the socket.
|
|
|
|
@param TcpTxData Pointer to the tcp txdata.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The operation is completed successfully.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES Failed due to resource limit.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
EFI_STATUS
|
|
|
|
SockProcessTcpSndData (
|
2008-12-16 03:57:53 +01:00
|
|
|
IN SOCKET *Sock,
|
|
|
|
IN VOID *TcpTxData
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-12-16 03:57:53 +01:00
|
|
|
/**
|
|
|
|
Copy data from socket buffer to application provided receive buffer.
|
|
|
|
|
|
|
|
@param Sock Pointer to the socket.
|
|
|
|
@param TcpRxData Pointer to the application provided receive buffer.
|
|
|
|
@param RcvdBytes The maximum length of the data can be copied.
|
|
|
|
@param IsOOB If TURE the data is OOB, else the data is normal.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
VOID
|
|
|
|
SockSetTcpRxData (
|
2008-12-16 03:57:53 +01:00
|
|
|
IN SOCKET *Sock,
|
|
|
|
IN VOID *TcpRxData,
|
|
|
|
IN UINT32 RcvdBytes,
|
|
|
|
IN BOOLEAN IsOOB
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-12-16 03:57:53 +01:00
|
|
|
/**
|
|
|
|
Get received data from the socket layer to the receive token.
|
|
|
|
|
|
|
|
@param Sock Pointer to the socket.
|
|
|
|
@param RcvToken Pointer to the application provided receive token.
|
|
|
|
|
|
|
|
@return The length of data received in this token.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
UINT32
|
|
|
|
SockProcessRcvToken (
|
2008-12-29 13:58:38 +01:00
|
|
|
IN SOCKET *Sock,
|
|
|
|
IN OUT SOCK_IO_TOKEN *RcvToken
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-12-16 03:57:53 +01:00
|
|
|
/**
|
|
|
|
Flush the socket.
|
|
|
|
|
|
|
|
@param Sock Pointer to the socket.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
VOID
|
|
|
|
SockConnFlush (
|
2008-12-29 13:58:38 +01:00
|
|
|
IN OUT SOCKET *Sock
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
2008-12-16 03:57:53 +01:00
|
|
|
/**
|
|
|
|
Create a socket with initial data SockInitData.
|
|
|
|
|
|
|
|
@param SockInitData Pointer to the initial data of the socket.
|
|
|
|
|
|
|
|
@return Pointer to the newly created socket.
|
|
|
|
|
|
|
|
**/
|
2008-12-06 00:47:55 +01:00
|
|
|
SOCKET *
|
2007-09-30 05:08:02 +02:00
|
|
|
SockCreate (
|
|
|
|
IN SOCK_INIT_DATA *SockInitData
|
|
|
|
);
|
|
|
|
|
2008-12-16 03:57:53 +01:00
|
|
|
/**
|
|
|
|
Destroy a socket.
|
|
|
|
|
|
|
|
@param Sock Pointer to the socket.
|
|
|
|
|
|
|
|
**/
|
2007-09-30 05:08:02 +02:00
|
|
|
VOID
|
|
|
|
SockDestroy (
|
2008-12-29 13:58:38 +01:00
|
|
|
IN OUT SOCKET *Sock
|
2007-09-30 05:08:02 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|