1 /** @file 2 Socket implementation header file. 3 4 Copyright (c) 2005 - 2006, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php<BR> 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 **/ 14 15 #ifndef _SOCK_IMPL_H_ 16 #define _SOCK_IMPL_H_ 17 18 #include "Socket.h" 19 20 /** 21 Signal a event with the given status. 22 23 @param Token The token's event is to be signaled. 24 @param TokenStatus The status to be sent with the event. 25 26 **/ 27 #define SIGNAL_TOKEN(Token, TokenStatus) \ 28 do { \ 29 (Token)->Status = (TokenStatus); \ 30 gBS->SignalEvent ((Token)->Event); \ 31 } while (0) 32 33 34 /** 35 Supporting function for both SockImpl and SockInterface. 36 37 @param Event The Event this notify function registered to, ignored. 38 39 **/ 40 VOID 41 EFIAPI 42 SockFreeFoo ( 43 IN EFI_EVENT Event 44 ); 45 46 /** 47 Process the TCP send data, buffer the tcp txdata and append 48 the buffer to socket send buffer,then try to send it. 49 50 @param Sock Pointer to the socket. 51 @param TcpTxData Pointer to the tcp txdata. 52 53 @retval EFI_SUCCESS The operation is completed successfully. 54 @retval EFI_OUT_OF_RESOURCES Failed due to resource limit. 55 56 **/ 57 EFI_STATUS 58 SockProcessTcpSndData ( 59 IN SOCKET *Sock, 60 IN VOID *TcpTxData 61 ); 62 63 /** 64 Copy data from socket buffer to application provided receive buffer. 65 66 @param Sock Pointer to the socket. 67 @param TcpRxData Pointer to the application provided receive buffer. 68 @param RcvdBytes The maximum length of the data can be copied. 69 @param IsOOB If TRUE the data is OOB, else the data is normal. 70 71 **/ 72 VOID 73 SockSetTcpRxData ( 74 IN SOCKET *Sock, 75 IN VOID *TcpRxData, 76 IN UINT32 RcvdBytes, 77 IN BOOLEAN IsOOB 78 ); 79 80 /** 81 Get received data from the socket layer to the receive token. 82 83 @param Sock Pointer to the socket. 84 @param RcvToken Pointer to the application provided receive token. 85 86 @return The length of data received in this token. 87 88 **/ 89 UINT32 90 SockProcessRcvToken ( 91 IN SOCKET *Sock, 92 IN OUT SOCK_IO_TOKEN *RcvToken 93 ); 94 95 /** 96 Flush the socket. 97 98 @param Sock Pointer to the socket. 99 100 **/ 101 VOID 102 SockConnFlush ( 103 IN OUT SOCKET *Sock 104 ); 105 106 /** 107 Create a socket with initial data SockInitData. 108 109 @param SockInitData Pointer to the initial data of the socket. 110 111 @return Pointer to the newly created socket. 112 113 **/ 114 SOCKET * 115 SockCreate ( 116 IN SOCK_INIT_DATA *SockInitData 117 ); 118 119 /** 120 Destroy a socket. 121 122 @param Sock Pointer to the socket. 123 124 **/ 125 VOID 126 SockDestroy ( 127 IN OUT SOCKET *Sock 128 ); 129 130 #endif 131