[WSD] Use socket reference count to control destruction.
[mirror/winof/.git] / ulp / wsd / user / ibspproto.h
1 /*\r
2  * Copyright (c) 2005 SilverStorm Technologies.  All rights reserved.\r
3  *\r
4  * This software is available to you under the OpenIB.org BSD license\r
5  * below:\r
6  *\r
7  *     Redistribution and use in source and binary forms, with or\r
8  *     without modification, are permitted provided that the following\r
9  *     conditions are met:\r
10  *\r
11  *      - Redistributions of source code must retain the above\r
12  *        copyright notice, this list of conditions and the following\r
13  *        disclaimer.\r
14  *\r
15  *      - Redistributions in binary form must reproduce the above\r
16  *        copyright notice, this list of conditions and the following\r
17  *        disclaimer in the documentation and/or other materials\r
18  *        provided with the distribution.\r
19  *\r
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
23  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
24  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
25  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
26  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
27  * SOFTWARE.\r
28  *\r
29  * $Id$\r
30  */\r
31 \r
32 /* protos from socketinfo.c */\r
33 struct ibsp_socket_info *\r
34 create_socket_info( void );\r
35 \r
36 void AL_API\r
37 deref_socket_info(\r
38         IN                              struct ibsp_socket_info         *p_socket );\r
39 \r
40 /* protos from extension.c */\r
41 HANDLE WSPAPI\r
42 IBSPRegisterMemory(\r
43         IN                              SOCKET                                          s,\r
44         IN                              PVOID                                           lpBuffer,\r
45         IN                              DWORD                                           dwBufferLength,\r
46         IN                              DWORD                                           dwFlags,\r
47                 OUT                     LPINT                                           lpErrno );\r
48 \r
49 int WSPAPI\r
50 IBSPDeregisterMemory(\r
51         IN                              SOCKET                                          s,\r
52         IN                              HANDLE                                          handle,\r
53                 OUT                     LPINT                                           lpErrno );\r
54 \r
55 int WSPAPI\r
56 IBSPRegisterRdmaMemory(\r
57         IN                              SOCKET                                          s,\r
58         IN                              PVOID                                           lpBuffer,\r
59         IN                              DWORD                                           dwBufferLength,\r
60         IN                              DWORD                                           dwFlags,\r
61                 OUT                     LPVOID                                          lpRdmaBufferDescriptor,\r
62         IN      OUT                     LPDWORD                                         lpdwDescriptorLength,\r
63                 OUT                     LPINT                                           lpErrno );\r
64 \r
65 int WSPAPI\r
66 IBSPDeregisterRdmaMemory(\r
67         IN                              SOCKET                                          s,\r
68         IN                              LPVOID                                          lpRdmaBufferDescriptor,\r
69         IN                              DWORD                                           dwDescriptorLength,\r
70                 OUT                     LPINT                                           lpErrno );\r
71 \r
72 int WSPAPI\r
73 IBSPRdmaWrite(\r
74         IN                              SOCKET                                          s,\r
75         IN                              LPWSABUFEX                                      lpBuffers,\r
76         IN                              DWORD                                           dwBufferCount,\r
77         IN                              LPVOID                                          lpTargetBufferDescriptor,\r
78         IN                              DWORD                                           dwTargetDescriptorLength,\r
79         IN                              DWORD                                           dwTargetBufferOffset,\r
80                 OUT                     LPDWORD                                         lpdwNumberOfBytesWritten,\r
81         IN                              DWORD                                           dwFlags,\r
82         IN                              LPWSAOVERLAPPED                         lpOverlapped,\r
83         IN                              LPWSAOVERLAPPED_COMPLETION_ROUTINE      lpCompletionRoutine,\r
84         IN                              LPWSATHREADID                           lpThreadId,\r
85                 OUT                     LPINT                                           lpErrno );\r
86 \r
87 int WSPAPI\r
88 IBSPRdmaRead(\r
89         IN                              SOCKET                                          s,\r
90         IN                              LPWSABUFEX                                      lpBuffers,\r
91         IN                              DWORD                                           dwBufferCount,\r
92         IN                              LPVOID                                          lpTargetBufferDescriptor,\r
93         IN                              DWORD                                           dwTargetDescriptorLength,\r
94         IN                              DWORD                                           dwTargetBufferOffset,\r
95                 OUT                     LPDWORD                                         lpdwNumberOfBytesRead,\r
96         IN                              DWORD                                           dwFlags,\r
97         IN                              LPWSAOVERLAPPED                         lpOverlapped,\r
98         IN                              LPWSAOVERLAPPED_COMPLETION_ROUTINE      lpCompletionRoutine,\r
99         IN                              LPWSATHREADID                           lpThreadId,\r
100                 OUT                     LPINT                                           lpErrno );\r
101 \r
102 int WSPAPI\r
103 IBSPMemoryRegistrationCacheCallback(\r
104         IN                              LPVOID                                          lpvAddress,\r
105         IN                              SIZE_T                                          Size,\r
106                 OUT                     LPINT                                           lpErrno );\r
107 \r
108 /* Protos from ibsp_iblow.c */\r
109 extern void\r
110 ib_release( void );\r
111 \r
112 extern int\r
113 ibsp_initialize( void );\r
114 \r
115 void\r
116 ib_release_cq_tinfo(\r
117                                         struct cq_thread_info           *cq_tinfo );\r
118 \r
119 void\r
120 ib_destroy_cq_tinfo(\r
121                                         struct cq_thread_info           *cq_tinfo );\r
122 \r
123 int\r
124 ib_create_socket(\r
125         IN      OUT                     struct ibsp_socket_info         *socket_info );\r
126 \r
127 void\r
128 ib_destroy_socket(\r
129         IN      OUT                     struct ibsp_socket_info         *socket_info );\r
130 \r
131 void\r
132 shutdown_and_destroy_socket_info(\r
133         IN      OUT                     struct ibsp_socket_info         *socket_info );\r
134 \r
135 void\r
136 ib_cq_comp(\r
137                                         void                                            *cq_context );\r
138 \r
139 void\r
140 wait_cq_drain(\r
141         IN      OUT                     struct ibsp_socket_info         *socket_info );\r
142 \r
143 void\r
144 ibsp_dup_overlap_abort(\r
145         IN      OUT                     struct ibsp_socket_info         *socket_info );\r
146 \r
147 /* Protos from misc.c */\r
148 extern int\r
149 ibal_to_wsa_error(\r
150         IN                              const ib_api_status_t           status );\r
151 \r
152 /* Protos from ibsp_ip.c */\r
153 void\r
154 update_all_ip_addrs(void);\r
155 \r
156 intn_t CL_API\r
157 ip_cmp(\r
158         IN      const void* const               p_key1,\r
159         IN      const void*     const           p_key2 );\r
160 \r
161 int\r
162 query_guid_address(\r
163         IN                              struct ibsp_port                        *port,\r
164         IN                              ib_net32_t                                      ip_addr,\r
165                 OUT                     ib_net64_t                                      *port_guid );\r
166 \r
167 int\r
168 query_pr(\r
169         IN                              struct ibsp_port                        *port,\r
170         IN                              ib_net64_t                                      dest_port_guid,\r
171                 OUT                     ib_path_rec_t                           *path_rec );\r
172 \r
173 int\r
174 build_ip_list(\r
175         IN      OUT                     LPSOCKET_ADDRESS_LIST           ip_list,\r
176         IN      OUT                     LPDWORD                                         ip_list_size,\r
177                 OUT                     LPINT                                           lpErrno );\r
178 \r
179 struct ibsp_port*\r
180 get_port_from_ip_address(\r
181         IN              const   struct in_addr                          sin_addr );\r
182 \r
183 /* Protos from ibsp_cm.c */\r
184 extern int\r
185 ib_listen(\r
186         IN                              struct ibsp_socket_info         *socket_info );\r
187 \r
188 void\r
189 ib_listen_cancel(\r
190         IN                              struct ibsp_socket_info         *socket_info );\r
191 \r
192 void\r
193 ib_reject(\r
194         IN              const   ib_cm_handle_t                          h_cm,\r
195         IN              const   ib_rej_status_t                         rej_status );\r
196 \r
197 int\r
198 ib_accept(\r
199         IN                              struct ibsp_socket_info         *socket_info,\r
200         IN                              ib_cm_req_rec_t                         *cm_req_received );\r
201 \r
202 int\r
203 ib_connect(\r
204         IN                              struct ibsp_socket_info         *socket_info,\r
205         IN                              ib_path_rec_t                           *path_rec );\r
206 \r
207 void\r
208 ib_disconnect(\r
209         IN                              struct ibsp_socket_info         *socket_info,\r
210         IN                              struct disconnect_reason        *reason );\r
211 \r
212 void\r
213 ib_listen_backlog(\r
214         IN                              struct ibsp_socket_info         *socket_info,\r
215         IN                              int                                                     backlog );\r
216 \r
217 /* ibsp_pnp.h */\r
218 ib_api_status_t\r
219 register_pnp( void );\r
220 \r
221 void\r
222 unregister_pnp( void );\r
223 \r
224 void\r
225 pnp_ca_remove(\r
226                                         struct ibsp_hca                         *hca);\r
227 \r
228 /* ibsp_duplicate.c */\r
229 int\r
230 setup_duplicate_socket(\r
231         IN                              struct ibsp_socket_info         *socket_info,\r
232         IN                              DWORD                                           identifier );\r
233 \r
234 int\r
235 prepare_duplicate_socket(\r
236         IN                              struct ibsp_socket_info         *socket_info,\r
237         IN                              DWORD                                           dwProcessId );\r
238 \r
239 /* ibsp_mem.c */\r
240 struct memory_node *\r
241 lookup_partial_mr(\r
242         IN                              struct mr_list                          *mem_list,\r
243         IN                              ib_access_t                                     acl_mask,\r
244         IN                              void                                            *start,\r
245         IN                              size_t                                          len );\r
246 \r
247 struct memory_node *\r
248 ib_register_memory(\r
249         IN                              struct mr_list                          *mem_list,\r
250         IN                              ib_pd_handle_t                          pd,\r
251         IN                              void                                            *start,\r
252         IN                              size_t                                          len,\r
253         IN                              ib_access_t                                     access_ctrl,\r
254                 OUT                     LPINT                                           lpErrno );\r
255 \r
256 int\r
257 ib_deregister_memory(\r
258         IN                              struct mr_list                          *mem_list,\r
259         IN                              struct memory_node                      *node,\r
260                 OUT                     LPINT                                           lpErrno );\r
261 \r
262 void\r
263 ib_deregister_all_mr(\r
264         IN                              struct mr_list                          *mem_list );\r
265 \r
266 int\r
267 ibsp_conn_insert(\r
268         IN                              struct ibsp_socket_info         *socket_info );\r
269 \r
270 void\r
271 ibsp_conn_remove(\r
272         IN                              struct ibsp_socket_info         *socket_info );\r
273 \r
274 void\r
275 ibsp_post_select_event(\r
276                                         struct ibsp_socket_info         *socket_info,\r
277                                         int                                                     event,\r
278                                         int                                                     error );\r
279 \r
280 /* ibspdll.c */\r
281 extern int\r
282 init_globals( void );\r
283 \r
284 extern void\r
285 release_globals( void );\r