1 | /** @file
|
---|
2 | The function declaration that provided for Socket Interface.
|
---|
3 |
|
---|
4 | Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
5 |
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #ifndef _SOCK_IMPL_H_
|
---|
11 | #define _SOCK_IMPL_H_
|
---|
12 |
|
---|
13 | #include "Socket.h"
|
---|
14 | #include "TcpMain.h"
|
---|
15 |
|
---|
16 | /**
|
---|
17 | Signal a event with the given status.
|
---|
18 |
|
---|
19 | @param[in] Token The token's event is to be signaled.
|
---|
20 | @param[in] TokenStatus The status to be sent with the event.
|
---|
21 |
|
---|
22 | **/
|
---|
23 | #define SIGNAL_TOKEN(Token, TokenStatus) \
|
---|
24 | do { \
|
---|
25 | (Token)->Status = (TokenStatus); \
|
---|
26 | gBS->SignalEvent ((Token)->Event); \
|
---|
27 | } while (0)
|
---|
28 |
|
---|
29 | #define SOCK_HEADER_SPACE (60 + 60 + 72)
|
---|
30 |
|
---|
31 | /**
|
---|
32 | Process the TCP send data, buffer the tcp txdata and append
|
---|
33 | the buffer to socket send buffer, then try to send it.
|
---|
34 |
|
---|
35 | @param[in] Sock Pointer to the socket.
|
---|
36 | @param[in] TcpTxData Pointer to the application provided send buffer.
|
---|
37 |
|
---|
38 | @retval EFI_SUCCESS The operation completed successfully.
|
---|
39 | @retval EFI_OUT_OF_RESOURCES Failed due to resource limits.
|
---|
40 |
|
---|
41 | **/
|
---|
42 | EFI_STATUS
|
---|
43 | SockProcessTcpSndData (
|
---|
44 | IN SOCKET *Sock,
|
---|
45 | IN VOID *TcpTxData
|
---|
46 | );
|
---|
47 |
|
---|
48 | /**
|
---|
49 | Get received data from the socket layer to the receive token.
|
---|
50 |
|
---|
51 | @param[in, out] Sock Pointer to the socket.
|
---|
52 | @param[in, out] RcvToken Pointer to the application provided receive token.
|
---|
53 |
|
---|
54 | @return The length of data received in this token.
|
---|
55 |
|
---|
56 | **/
|
---|
57 | UINT32
|
---|
58 | SockProcessRcvToken (
|
---|
59 | IN OUT SOCKET *Sock,
|
---|
60 | IN OUT SOCK_IO_TOKEN *RcvToken
|
---|
61 | );
|
---|
62 |
|
---|
63 | /**
|
---|
64 | Flush the sndBuffer and rcvBuffer of socket.
|
---|
65 |
|
---|
66 | @param[in, out] Sock Pointer to the socket.
|
---|
67 |
|
---|
68 | **/
|
---|
69 | VOID
|
---|
70 | SockConnFlush (
|
---|
71 | IN OUT SOCKET *Sock
|
---|
72 | );
|
---|
73 |
|
---|
74 | /**
|
---|
75 | Cancel the tokens in the specific token list.
|
---|
76 |
|
---|
77 | @param[in] Token Pointer to the Token. If NULL, all tokens
|
---|
78 | in SpecifiedTokenList will be canceled.
|
---|
79 | @param[in, out] SpecifiedTokenList Pointer to the token list to be checked.
|
---|
80 |
|
---|
81 | @retval EFI_SUCCESS Cancel the tokens in the specific token listsuccessfully.
|
---|
82 | @retval EFI_NOT_FOUND The Token is not found in SpecifiedTokenList.
|
---|
83 |
|
---|
84 | **/
|
---|
85 | EFI_STATUS
|
---|
86 | SockCancelToken (
|
---|
87 | IN SOCK_COMPLETION_TOKEN *Token,
|
---|
88 | IN OUT LIST_ENTRY *SpecifiedTokenList
|
---|
89 | );
|
---|
90 |
|
---|
91 | /**
|
---|
92 | Create a socket with initial data SockInitData.
|
---|
93 |
|
---|
94 | @param[in] SockInitData Pointer to the initial data of the socket.
|
---|
95 |
|
---|
96 | @return Pointer to the newly created socket, return NULL when exception occured.
|
---|
97 |
|
---|
98 | **/
|
---|
99 | SOCKET *
|
---|
100 | SockCreate (
|
---|
101 | IN SOCK_INIT_DATA *SockInitData
|
---|
102 | );
|
---|
103 |
|
---|
104 | /**
|
---|
105 | Destroy a socket.
|
---|
106 |
|
---|
107 | @param[in, out] Sock Pointer to the socket.
|
---|
108 |
|
---|
109 | **/
|
---|
110 | VOID
|
---|
111 | SockDestroy (
|
---|
112 | IN OUT SOCKET *Sock
|
---|
113 | );
|
---|
114 |
|
---|
115 | #endif
|
---|