]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.h
004f1cbec4df88a23081ea9f19378ac052ed1efb
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / SockImpl.h
1 /** @file
2 Socket implementation header file.
3
4 Copyright (c) 2005 - 2006, Intel Corporation<BR>
5 All rights reserved. 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 SockFreeFoo (
42 IN EFI_EVENT Event
43 );
44
45 /**
46 Process the TCP send data, buffer the tcp txdata and append
47 the buffer to socket send buffer,then try to send it.
48
49 @param Sock Pointer to the socket.
50 @param TcpTxData Pointer to the tcp txdata.
51
52 @retval EFI_SUCCESS The operation is completed successfully.
53 @retval EFI_OUT_OF_RESOURCES Failed due to resource limit.
54
55 **/
56 EFI_STATUS
57 SockProcessTcpSndData (
58 IN SOCKET *Sock,
59 IN VOID *TcpTxData
60 );
61
62 /**
63 Copy data from socket buffer to application provided receive buffer.
64
65 @param Sock Pointer to the socket.
66 @param TcpRxData Pointer to the application provided receive buffer.
67 @param RcvdBytes The maximum length of the data can be copied.
68 @param IsOOB If TURE the data is OOB, else the data is normal.
69
70 **/
71 VOID
72 SockSetTcpRxData (
73 IN SOCKET *Sock,
74 IN VOID *TcpRxData,
75 IN UINT32 RcvdBytes,
76 IN BOOLEAN IsOOB
77 );
78
79 /**
80 Get received data from the socket layer to the receive token.
81
82 @param Sock Pointer to the socket.
83 @param RcvToken Pointer to the application provided receive token.
84
85 @return The length of data received in this token.
86
87 **/
88 UINT32
89 SockProcessRcvToken (
90 IN SOCKET *Sock,
91 IN OUT SOCK_IO_TOKEN *RcvToken
92 );
93
94 /**
95 Flush the socket.
96
97 @param Sock Pointer to the socket.
98
99 **/
100 VOID
101 SockConnFlush (
102 IN OUT SOCKET *Sock
103 );
104
105 /**
106 Create a socket with initial data SockInitData.
107
108 @param SockInitData Pointer to the initial data of the socket.
109
110 @return Pointer to the newly created socket.
111
112 **/
113 SOCKET *
114 SockCreate (
115 IN SOCK_INIT_DATA *SockInitData
116 );
117
118 /**
119 Destroy a socket.
120
121 @param Sock Pointer to the socket.
122
123 **/
124 VOID
125 SockDestroy (
126 IN OUT SOCKET *Sock
127 );
128
129 #endif