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