Sync the bug that list node is free before it is removed from the list. That made...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / Tcp4Dxe / Tcp4Driver.h
1 /** @file
2
3 Copyright (c) 2005 - 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 Tcp4Driver.h
15
16 Abstract:
17
18
19 **/
20
21 #ifndef _TCP4_DRIVER_H_
22 #define _TCP4_DRIVER_H_
23
24 #include <Protocol/ServiceBinding.h>
25 #include <Library/IpIoLib.h>
26
27 #define TCP4_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('T', 'C', 'P', '4')
28
29 #define TCP4_PORT_KNOWN 1024
30 #define TCP4_PORT_USER_RESERVED 65535
31
32 typedef struct _TCP4_HEARTBEAT_TIMER {
33 EFI_EVENT TimerEvent;
34 INTN RefCnt;
35 } TCP4_HEARTBEAT_TIMER;
36
37 typedef struct _TCP4_SERVICE_DATA {
38 UINT32 Signature;
39 EFI_HANDLE ControllerHandle;
40 IP_IO *IpIo; // IP Io consumed by TCP4
41 EFI_SERVICE_BINDING_PROTOCOL Tcp4ServiceBinding;
42 EFI_HANDLE DriverBindingHandle;
43 CHAR16 *MacString;
44 NET_LIST_ENTRY SocketList;
45 } TCP4_SERVICE_DATA;
46
47 //
48 // Prototype for TCP4 driver Rcv callback function registered to IP_IO
49 //
50 VOID
51 Tcp4RxCallback (
52 IN EFI_STATUS Status,
53 IN ICMP_ERROR IcmpErr,
54 IN EFI_NET_SESSION_DATA *NetSession,
55 IN NET_BUF *Pkt,
56 IN VOID *Context OPTIONAL
57 );
58
59 INTN
60 TcpSendIpPacket (
61 IN TCP_CB *Tcb,
62 IN NET_BUF *Nbuf,
63 IN UINT32 Src,
64 IN UINT32 Dest
65 );
66
67 EFI_STATUS
68 Tcp4Dispatcher (
69 IN SOCKET *Sock,
70 IN SOCK_REQUEST Request,
71 IN VOID *Data OPTIONAL
72 );
73
74 typedef struct _TCP4_PROTO_DATA {
75 TCP4_SERVICE_DATA *TcpService;
76 TCP_CB *TcpPcb;
77 } TCP4_PROTO_DATA;
78
79 #define TCP4_FROM_THIS(a) \
80 CR ( \
81 (a), \
82 TCP4_SERVICE_DATA, \
83 Tcp4ServiceBinding, \
84 TCP4_DRIVER_SIGNATURE \
85 )
86
87 //
88 // Function prototype for the driver's entry point
89 //
90 EFI_STATUS
91 EFIAPI
92 Tcp4DriverEntryPoint (
93 IN EFI_HANDLE ImageHandle,
94 IN EFI_SYSTEM_TABLE *SystemTable
95 );
96
97 //
98 // Function prototypes for the Drivr Binding Protocol
99 //
100 EFI_STATUS
101 EFIAPI
102 Tcp4DriverBindingSupported (
103 IN EFI_DRIVER_BINDING_PROTOCOL * This,
104 IN EFI_HANDLE ControllerHandle,
105 IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
106 );
107
108 EFI_STATUS
109 EFIAPI
110 Tcp4DriverBindingStart (
111 IN EFI_DRIVER_BINDING_PROTOCOL * This,
112 IN EFI_HANDLE ControllerHandle,
113 IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
114 );
115
116 EFI_STATUS
117 EFIAPI
118 Tcp4DriverBindingStop (
119 IN EFI_DRIVER_BINDING_PROTOCOL *This,
120 IN EFI_HANDLE ControllerHandle,
121 IN UINTN NumberOfChildren,
122 IN EFI_HANDLE *ChildHandleBuffer
123 );
124
125 EFI_STATUS
126 Tcp4CreateSocketCallback (
127 IN SOCKET *This,
128 IN VOID *Context
129 );
130
131 VOID
132 Tcp4DestroySocketCallback (
133 IN SOCKET *This,
134 IN VOID *Context
135 );
136
137 //
138 // Function ptototypes for the ServiceBinding Prococol
139 //
140 EFI_STATUS
141 EFIAPI
142 Tcp4ServiceBindingCreateChild (
143 IN EFI_SERVICE_BINDING_PROTOCOL *This,
144 IN EFI_HANDLE *ChildHandle
145 );
146
147 EFI_STATUS
148 EFIAPI
149 Tcp4ServiceBindingDestroyChild (
150 IN EFI_SERVICE_BINDING_PROTOCOL *This,
151 IN EFI_HANDLE ChildHandle
152 );
153
154 #endif