]>
Commit | Line | Data |
---|---|---|
a3bcde70 HT |
1 | /** @file\r |
2 | The function declaration that provided for Socket Interface.\r | |
3 | \r | |
5ffe214a | 4 | Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r |
a3bcde70 HT |
5 | \r |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php.\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _SOCK_IMPL_H_\r | |
17 | #define _SOCK_IMPL_H_\r | |
18 | \r | |
19 | #include "Socket.h"\r | |
20 | \r | |
21 | /**\r | |
22 | Signal a event with the given status.\r | |
23 | \r | |
24 | @param[in] Token The token's event is to be signaled.\r | |
25 | @param[in] TokenStatus The status to be sent with the event.\r | |
26 | \r | |
27 | **/\r | |
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 | |
34 | #define SOCK_HEADER_SPACE (60 + 60 + 72)\r | |
35 | \r | |
36 | /**\r | |
37 | Process the TCP send data, buffer the tcp txdata and append\r | |
38 | the buffer to socket send buffer, then try to send it.\r | |
39 | \r | |
40 | @param[in] Sock Pointer to the socket.\r | |
41 | @param[in] TcpTxData Pointer to the application provided send buffer.\r | |
42 | \r | |
43 | @retval EFI_SUCCESS The operation completed successfully.\r | |
44 | @retval EFI_OUT_OF_RESOURCES Failed due to resource limits.\r | |
45 | \r | |
46 | **/\r | |
47 | EFI_STATUS\r | |
48 | SockProcessTcpSndData (\r | |
49 | IN SOCKET *Sock,\r | |
50 | IN VOID *TcpTxData\r | |
51 | );\r | |
52 | \r | |
53 | /**\r | |
54 | Get received data from the socket layer to the receive token.\r | |
55 | \r | |
56 | @param[in, out] Sock Pointer to the socket.\r | |
57 | @param[in, out] RcvToken Pointer to the application provided receive token.\r | |
58 | \r | |
59 | @return The length of data received in this token.\r | |
60 | \r | |
61 | **/\r | |
62 | UINT32\r | |
63 | SockProcessRcvToken (\r | |
64 | IN OUT SOCKET *Sock,\r | |
65 | IN OUT SOCK_IO_TOKEN *RcvToken\r | |
66 | );\r | |
67 | \r | |
68 | /**\r | |
69 | Flush the sndBuffer and rcvBuffer of socket.\r | |
70 | \r | |
71 | @param[in, out] Sock Pointer to the socket.\r | |
72 | \r | |
73 | **/\r | |
74 | VOID\r | |
75 | SockConnFlush (\r | |
76 | IN OUT SOCKET *Sock\r | |
77 | );\r | |
78 | \r | |
5ffe214a JW |
79 | /**\r |
80 | Cancel the tokens in the specific token list.\r | |
81 | \r | |
82 | @param[in] Token Pointer to the Token. If NULL, all tokens \r | |
83 | in SpecifiedTokenList will be canceled. \r | |
84 | @param[in, out] SpecifiedTokenList Pointer to the token list to be checked.\r | |
85 | \r | |
86 | @retval EFI_SUCCESS Cancel the tokens in the specific token listsuccessfully.\r | |
87 | @retval EFI_NOT_FOUND The Token is not found in SpecifiedTokenList.\r | |
88 | \r | |
89 | **/\r | |
90 | EFI_STATUS\r | |
91 | SockCancelToken (\r | |
92 | IN SOCK_COMPLETION_TOKEN *Token,\r | |
93 | IN OUT LIST_ENTRY *SpecifiedTokenList\r | |
94 | );\r | |
95 | \r | |
a3bcde70 HT |
96 | /**\r |
97 | Create a socket with initial data SockInitData.\r | |
98 | \r | |
99 | @param[in] SockInitData Pointer to the initial data of the socket.\r | |
100 | \r | |
101 | @return Pointer to the newly created socket, return NULL when exception occured.\r | |
102 | \r | |
103 | **/\r | |
104 | SOCKET *\r | |
105 | SockCreate (\r | |
106 | IN SOCK_INIT_DATA *SockInitData\r | |
107 | );\r | |
108 | \r | |
109 | /**\r | |
110 | Destroy a socket.\r | |
111 | \r | |
112 | @param[in, out] Sock Pointer to the socket.\r | |
113 | \r | |
114 | **/\r | |
115 | VOID\r | |
116 | SockDestroy (\r | |
117 | IN OUT SOCKET *Sock\r | |
118 | );\r | |
119 | \r | |
120 | #endif\r |