]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.h
MdeModulePkg: Fix service binding issue in TCP4 and Ip4 dxe.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / SockImpl.h
1 /** @file
2 Socket implementation header file.
3
4 Copyright (c) 2005 - 2017, 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 #include "Tcp4Main.h"
20
21 /**
22 Signal a event with the given status.
23
24 @param Token The token's event is to be signaled.
25 @param TokenStatus The status to be sent with the event.
26
27 **/
28 #define SIGNAL_TOKEN(Token, TokenStatus) \
29 do { \
30 (Token)->Status = (TokenStatus); \
31 gBS->SignalEvent ((Token)->Event); \
32 } while (0)
33
34
35 /**
36 Supporting function for both SockImpl and SockInterface.
37
38 @param Event The Event this notify function registered to, ignored.
39
40 **/
41 VOID
42 EFIAPI
43 SockFreeFoo (
44 IN EFI_EVENT Event
45 );
46
47 /**
48 Process the TCP send data, buffer the tcp txdata and append
49 the buffer to socket send buffer,then try to send it.
50
51 @param Sock Pointer to the socket.
52 @param TcpTxData Pointer to the tcp txdata.
53
54 @retval EFI_SUCCESS The operation is completed successfully.
55 @retval EFI_OUT_OF_RESOURCES Failed due to resource limit.
56
57 **/
58 EFI_STATUS
59 SockProcessTcpSndData (
60 IN SOCKET *Sock,
61 IN VOID *TcpTxData
62 );
63
64 /**
65 Copy data from socket buffer to application provided receive buffer.
66
67 @param Sock Pointer to the socket.
68 @param TcpRxData Pointer to the application provided receive buffer.
69 @param RcvdBytes The maximum length of the data can be copied.
70 @param IsOOB If TRUE the data is OOB, else the data is normal.
71
72 **/
73 VOID
74 SockSetTcpRxData (
75 IN SOCKET *Sock,
76 IN VOID *TcpRxData,
77 IN UINT32 RcvdBytes,
78 IN BOOLEAN IsOOB
79 );
80
81 /**
82 Get received data from the socket layer to the receive token.
83
84 @param Sock Pointer to the socket.
85 @param RcvToken Pointer to the application provided receive token.
86
87 @return The length of data received in this token.
88
89 **/
90 UINT32
91 SockProcessRcvToken (
92 IN SOCKET *Sock,
93 IN OUT SOCK_IO_TOKEN *RcvToken
94 );
95
96 /**
97 Flush the socket.
98
99 @param Sock Pointer to the socket.
100
101 **/
102 VOID
103 SockConnFlush (
104 IN OUT SOCKET *Sock
105 );
106
107 /**
108 Create a socket with initial data SockInitData.
109
110 @param SockInitData Pointer to the initial data of the socket.
111
112 @return Pointer to the newly created socket.
113
114 **/
115 SOCKET *
116 SockCreate (
117 IN SOCK_INIT_DATA *SockInitData
118 );
119
120 /**
121 Destroy a socket.
122
123 @param Sock Pointer to the socket.
124
125 **/
126 VOID
127 SockDestroy (
128 IN OUT SOCKET *Sock
129 );
130
131 #endif