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