1 |
145 |
lanttu |
/*
|
2 |
|
|
* Copyright (c) 2010, Mentor Graphics Corporation
|
3 |
|
|
* All rights reserved.
|
4 |
|
|
*
|
5 |
|
|
* Redistribution and use in source and binary forms, with or without
|
6 |
|
|
* modification, are permitted provided that the following conditions are met:
|
7 |
|
|
*
|
8 |
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
9 |
|
|
* this list of conditions and the following disclaimer.
|
10 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
11 |
|
|
* this list of conditions and the following disclaimer in the documentation
|
12 |
|
|
* and/or other materials provided with the distribution.
|
13 |
|
|
* 3. Neither the name of the <ORGANIZATION> nor the names of its contributors
|
14 |
|
|
* may be used to endorse or promote products derived from this software
|
15 |
|
|
* without specific prior written permission.
|
16 |
|
|
*
|
17 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
18 |
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
19 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
20 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
21 |
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
22 |
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23 |
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24 |
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25 |
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
|
|
/*
|
31 |
|
|
* FILENAME
|
32 |
|
|
*
|
33 |
|
|
* fts_main.c
|
34 |
|
|
*
|
35 |
|
|
*
|
36 |
|
|
*************************************************************************/
|
37 |
|
|
|
38 |
|
|
#include "fts_defs.h"
|
39 |
|
|
#include "support_suite/mcapid_support.h"
|
40 |
|
|
|
41 |
|
|
extern MCAPI_MUTEX MCAPID_FTS_Mutex;
|
42 |
|
|
|
43 |
|
|
/************************************************************************
|
44 |
|
|
*
|
45 |
|
|
* FUNCTION
|
46 |
|
|
*
|
47 |
|
|
* MCAPI_FTS_Tx_2_16_1
|
48 |
|
|
*
|
49 |
|
|
* DESCRIPTION
|
50 |
|
|
*
|
51 |
|
|
* Testing mcapi_open_pktchan_send_i - open send side for endpoint
|
52 |
|
|
* connected as receiver.
|
53 |
|
|
*
|
54 |
|
|
* Node 0 – Create an endpoint, open the endpoint as a sender
|
55 |
|
|
*
|
56 |
|
|
* Node 1 – Create an endpoint, get endpoint on Node 0, issue
|
57 |
|
|
* connection, open the endpoint as a sender
|
58 |
|
|
*
|
59 |
|
|
*************************************************************************/
|
60 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_16_1)
|
61 |
|
|
{
|
62 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
63 |
|
|
size_t rx_len;
|
64 |
|
|
mcapi_status_t status;
|
65 |
|
|
mcapi_endpoint_t tx_endp;
|
66 |
|
|
mcapi_request_t request;
|
67 |
|
|
mcapi_endpoint_t endp;
|
68 |
|
|
|
69 |
|
|
/* Don't let any other test run while this test is running. */
|
70 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
71 |
|
|
|
72 |
|
|
/* An extra endpoint is required for this session. */
|
73 |
|
|
endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
|
74 |
|
|
|
75 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
76 |
|
|
{
|
77 |
|
|
/* Indicate that a remote endpoint should be created. */
|
78 |
|
|
mcapi_struct->status =
|
79 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
80 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
81 |
|
|
|
82 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
83 |
|
|
{
|
84 |
|
|
/* Wait for a response. */
|
85 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
86 |
|
|
|
87 |
|
|
/* If the endpoint was created. */
|
88 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
89 |
|
|
{
|
90 |
|
|
/* Indicate that the endpoint should be opened as a sender. */
|
91 |
|
|
mcapi_struct->status =
|
92 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT, 1024,
|
93 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
94 |
|
|
|
95 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
96 |
|
|
{
|
97 |
|
|
/* Wait for a response. */
|
98 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
99 |
|
|
|
100 |
|
|
/* If the send side was opened. */
|
101 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
102 |
|
|
{
|
103 |
|
|
/* Get the send side endpoint. */
|
104 |
|
|
tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
105 |
|
|
|
106 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
107 |
|
|
{
|
108 |
|
|
/* Connect the two endpoints. */
|
109 |
|
|
mcapi_connect_pktchan_i(tx_endp, endp,
|
110 |
|
|
&mcapi_struct->request,
|
111 |
|
|
&mcapi_struct->status);
|
112 |
|
|
|
113 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
114 |
|
|
{
|
115 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
116 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
117 |
|
|
|
118 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
119 |
|
|
{
|
120 |
|
|
/* Open the local endpoint as the sender too. */
|
121 |
|
|
mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
|
122 |
|
|
endp, &request,
|
123 |
|
|
&mcapi_struct->status);
|
124 |
|
|
|
125 |
|
|
/* Check for the correct error. */
|
126 |
|
|
if (mcapi_struct->status == MCAPI_ERR_CHAN_DIRECTION)
|
127 |
|
|
{
|
128 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
else
|
132 |
|
|
{
|
133 |
|
|
mcapi_struct->status = -1;
|
134 |
|
|
}
|
135 |
|
|
}
|
136 |
|
|
}
|
137 |
|
|
}
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
/* Tell the other side to close the send side. */
|
141 |
|
|
status =
|
142 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_PKT, 1024,
|
143 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
144 |
|
|
|
145 |
|
|
if (status == MCAPI_SUCCESS)
|
146 |
|
|
{
|
147 |
|
|
/* Wait for the response. */
|
148 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
149 |
|
|
}
|
150 |
|
|
}
|
151 |
|
|
|
152 |
|
|
/* Tell the other side to delete the endpoint. */
|
153 |
|
|
status =
|
154 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
155 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
156 |
|
|
|
157 |
|
|
if (status == MCAPI_SUCCESS)
|
158 |
|
|
{
|
159 |
|
|
/* Wait for the response. */
|
160 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
161 |
|
|
}
|
162 |
|
|
}
|
163 |
|
|
}
|
164 |
|
|
|
165 |
|
|
/* Delete the endpoint used for this session. */
|
166 |
|
|
mcapi_delete_endpoint(endp, &status);
|
167 |
|
|
}
|
168 |
|
|
|
169 |
|
|
/* Set the state of the test to completed. */
|
170 |
|
|
mcapi_struct->state = 0;
|
171 |
|
|
|
172 |
|
|
/* Allow the next test to run. */
|
173 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
174 |
|
|
|
175 |
|
|
} /* MCAPI_FTS_Tx_2_16_1 */
|
176 |
|
|
|
177 |
|
|
/************************************************************************
|
178 |
|
|
*
|
179 |
|
|
* FUNCTION
|
180 |
|
|
*
|
181 |
|
|
* MCAPI_FTS_Tx_2_16_2
|
182 |
|
|
*
|
183 |
|
|
* DESCRIPTION
|
184 |
|
|
*
|
185 |
|
|
* Testing mcapi_open_pktchan_send_i - duplicate call
|
186 |
|
|
*
|
187 |
|
|
* Node 1 – Create an endpoint, open the endpoint as a sender,
|
188 |
|
|
* open the endpoint as a sender again
|
189 |
|
|
*
|
190 |
|
|
*************************************************************************/
|
191 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_16_2)
|
192 |
|
|
{
|
193 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
194 |
|
|
mcapi_request_t request;
|
195 |
|
|
mcapi_status_t status;
|
196 |
|
|
|
197 |
|
|
/* Don't let any other test run while this test is running. */
|
198 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
199 |
|
|
|
200 |
|
|
/* Open the local endpoint as the sender. */
|
201 |
|
|
mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
|
202 |
|
|
mcapi_struct->local_endp,
|
203 |
|
|
&request, &mcapi_struct->status);
|
204 |
|
|
|
205 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
206 |
|
|
{
|
207 |
|
|
/* Open the local endpoint as the sender again. */
|
208 |
|
|
mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
|
209 |
|
|
mcapi_struct->local_endp,
|
210 |
|
|
&mcapi_struct->request, &mcapi_struct->status);
|
211 |
|
|
|
212 |
|
|
/* Ensure the proper error code was returned. */
|
213 |
|
|
if (mcapi_struct->status == MCAPI_ERR_CHAN_CONNECTED)
|
214 |
|
|
{
|
215 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
216 |
|
|
}
|
217 |
|
|
|
218 |
|
|
else
|
219 |
|
|
{
|
220 |
|
|
mcapi_struct->status = -1;
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
/* Close the send side. */
|
224 |
|
|
mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
|
225 |
|
|
&mcapi_struct->request, &status);
|
226 |
|
|
}
|
227 |
|
|
|
228 |
|
|
/* Set the state of the test to completed. */
|
229 |
|
|
mcapi_struct->state = 0;
|
230 |
|
|
|
231 |
|
|
/* Allow the next test to run. */
|
232 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
233 |
|
|
|
234 |
|
|
} /* MCAPI_FTS_Tx_2_16_2 */
|
235 |
|
|
|
236 |
|
|
/************************************************************************
|
237 |
|
|
*
|
238 |
|
|
* FUNCTION
|
239 |
|
|
*
|
240 |
|
|
* MCAPI_FTS_Tx_2_16_3
|
241 |
|
|
*
|
242 |
|
|
* DESCRIPTION
|
243 |
|
|
*
|
244 |
|
|
* Testing mcapi_open_pktchan_send_i - reopen the same endpoint -
|
245 |
|
|
* never connected
|
246 |
|
|
*
|
247 |
|
|
* Node 1 – Create an endpoint, open the endpoint as a sender,
|
248 |
|
|
* close, open the endpoint as a sender again
|
249 |
|
|
*
|
250 |
|
|
*************************************************************************/
|
251 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_16_3)
|
252 |
|
|
{
|
253 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
254 |
|
|
mcapi_request_t request;
|
255 |
|
|
mcapi_status_t status;
|
256 |
|
|
|
257 |
|
|
/* Don't let any other test run while this test is running. */
|
258 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
259 |
|
|
|
260 |
|
|
/* Open the local endpoint as the sender. */
|
261 |
|
|
mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
|
262 |
|
|
mcapi_struct->local_endp,
|
263 |
|
|
&request, &mcapi_struct->status);
|
264 |
|
|
|
265 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
266 |
|
|
{
|
267 |
|
|
/* Close the send side. */
|
268 |
|
|
mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
|
269 |
|
|
&mcapi_struct->request,
|
270 |
|
|
&mcapi_struct->status);
|
271 |
|
|
|
272 |
|
|
/* Ensure the proper error code was returned. */
|
273 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
274 |
|
|
{
|
275 |
|
|
/* Open the local endpoint as the sender again. */
|
276 |
|
|
mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
|
277 |
|
|
mcapi_struct->local_endp,
|
278 |
|
|
&request, &mcapi_struct->status);
|
279 |
|
|
|
280 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
281 |
|
|
{
|
282 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
283 |
|
|
}
|
284 |
|
|
|
285 |
|
|
else
|
286 |
|
|
{
|
287 |
|
|
mcapi_struct->status = -1;
|
288 |
|
|
}
|
289 |
|
|
|
290 |
|
|
/* Close the send side. */
|
291 |
|
|
mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
|
292 |
|
|
&mcapi_struct->request, &status);
|
293 |
|
|
}
|
294 |
|
|
}
|
295 |
|
|
|
296 |
|
|
/* Set the state of the test to completed. */
|
297 |
|
|
mcapi_struct->state = 0;
|
298 |
|
|
|
299 |
|
|
/* Allow the next test to run. */
|
300 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
301 |
|
|
|
302 |
|
|
} /* MCAPI_FTS_Tx_2_16_3 */
|
303 |
|
|
|
304 |
|
|
/************************************************************************
|
305 |
|
|
*
|
306 |
|
|
* FUNCTION
|
307 |
|
|
*
|
308 |
|
|
* MCAPI_FTS_Tx_2_16_4
|
309 |
|
|
*
|
310 |
|
|
* DESCRIPTION
|
311 |
|
|
*
|
312 |
|
|
* Testing mcapi_open_pktchan_send_i - reopen same endpoint -
|
313 |
|
|
* half connected.
|
314 |
|
|
*
|
315 |
|
|
* Node 0 – Create endpoint
|
316 |
|
|
*
|
317 |
|
|
* Node 1 – Create an endpoint, get the endpoint on Node 0, open
|
318 |
|
|
* the endpoint as a sender, issue the connection,
|
319 |
|
|
* close, open the endpoint as a sender again.
|
320 |
|
|
*
|
321 |
|
|
*************************************************************************/
|
322 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_16_4)
|
323 |
|
|
{
|
324 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
325 |
|
|
size_t rx_len;
|
326 |
|
|
mcapi_status_t status;
|
327 |
|
|
mcapi_endpoint_t rx_endp;
|
328 |
|
|
mcapi_request_t request;
|
329 |
|
|
|
330 |
|
|
/* Don't let any other test run while this test is running. */
|
331 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
332 |
|
|
|
333 |
|
|
/* Indicate that a remote endpoint should be created. */
|
334 |
|
|
mcapi_struct->status =
|
335 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
|
336 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
337 |
|
|
|
338 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
339 |
|
|
{
|
340 |
|
|
/* Wait for a response. */
|
341 |
|
|
mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
342 |
|
|
|
343 |
|
|
/* If the endpoint was created. */
|
344 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
345 |
|
|
{
|
346 |
|
|
/* Open the local endpoint as the sender. */
|
347 |
|
|
mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
|
348 |
|
|
mcapi_struct->local_endp, &request,
|
349 |
|
|
&mcapi_struct->status);
|
350 |
|
|
|
351 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
352 |
|
|
{
|
353 |
|
|
/* Get the receive side endpoint. */
|
354 |
|
|
rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
|
355 |
|
|
|
356 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
357 |
|
|
{
|
358 |
|
|
/* Connect the two endpoints. */
|
359 |
|
|
mcapi_connect_pktchan_i(mcapi_struct->local_endp, rx_endp,
|
360 |
|
|
&mcapi_struct->request,
|
361 |
|
|
&mcapi_struct->status);
|
362 |
|
|
|
363 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
364 |
|
|
{
|
365 |
|
|
/* Wait for the connect call to return successfully. */
|
366 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
367 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
368 |
|
|
|
369 |
|
|
/* Close the send side. */
|
370 |
|
|
mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
|
371 |
|
|
&mcapi_struct->request,
|
372 |
|
|
&mcapi_struct->status);
|
373 |
|
|
|
374 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
375 |
|
|
{
|
376 |
|
|
/* Open the local endpoint again as the sender. */
|
377 |
|
|
mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
|
378 |
|
|
mcapi_struct->local_endp, &request,
|
379 |
|
|
&mcapi_struct->status);
|
380 |
|
|
|
381 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
382 |
|
|
{
|
383 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
384 |
|
|
|
385 |
|
|
/* Close the send side. */
|
386 |
|
|
mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
|
387 |
|
|
&mcapi_struct->request,
|
388 |
|
|
&status);
|
389 |
|
|
}
|
390 |
|
|
|
391 |
|
|
else
|
392 |
|
|
{
|
393 |
|
|
mcapi_struct->status = -1;
|
394 |
|
|
}
|
395 |
|
|
}
|
396 |
|
|
}
|
397 |
|
|
}
|
398 |
|
|
}
|
399 |
|
|
|
400 |
|
|
/* Tell the other side to delete the endpoint. */
|
401 |
|
|
status =
|
402 |
|
|
MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
|
403 |
|
|
mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
|
404 |
|
|
|
405 |
|
|
if (status == MCAPI_SUCCESS)
|
406 |
|
|
{
|
407 |
|
|
/* Wait for the response. */
|
408 |
|
|
status = MCAPID_RX_Mgmt_Response(mcapi_struct);
|
409 |
|
|
}
|
410 |
|
|
}
|
411 |
|
|
}
|
412 |
|
|
|
413 |
|
|
/* Set the state of the test to completed. */
|
414 |
|
|
mcapi_struct->state = 0;
|
415 |
|
|
|
416 |
|
|
/* Allow the next test to run. */
|
417 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
418 |
|
|
|
419 |
|
|
} /* MCAPI_FTS_Tx_2_16_4 */
|
420 |
|
|
|
421 |
|
|
/************************************************************************
|
422 |
|
|
*
|
423 |
|
|
* FUNCTION
|
424 |
|
|
*
|
425 |
|
|
* MCAPI_FTS_Tx_2_16_5
|
426 |
|
|
*
|
427 |
|
|
* DESCRIPTION
|
428 |
|
|
*
|
429 |
|
|
* Testing mcapi_open_pktchan_send_i - reopen same endpoint -
|
430 |
|
|
* previously connected
|
431 |
|
|
*
|
432 |
|
|
* Node 0 – Create an endpoint, open receive side
|
433 |
|
|
*
|
434 |
|
|
* Node 1 – Create an endpoint, get the endpoint on Node 0, open
|
435 |
|
|
* the endpoint as a sender, issue the connection,
|
436 |
|
|
* close, open the endpoint as a sender again
|
437 |
|
|
*
|
438 |
|
|
*************************************************************************/
|
439 |
|
|
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_16_5)
|
440 |
|
|
{
|
441 |
|
|
MCAPID_STRUCT *mcapi_struct = (MCAPID_STRUCT*)argv;
|
442 |
|
|
size_t rx_len;
|
443 |
|
|
mcapi_status_t status;
|
444 |
|
|
mcapi_request_t request;
|
445 |
|
|
|
446 |
|
|
/* Don't let any other test run while this test is running. */
|
447 |
|
|
MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
|
448 |
|
|
|
449 |
|
|
/* Connect the two endpoints. */
|
450 |
|
|
mcapi_connect_pktchan_i(mcapi_struct->local_endp,
|
451 |
|
|
mcapi_struct->foreign_endp,
|
452 |
|
|
&mcapi_struct->request,
|
453 |
|
|
&mcapi_struct->status);
|
454 |
|
|
|
455 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
456 |
|
|
{
|
457 |
|
|
mcapi_wait(&mcapi_struct->request, &rx_len,
|
458 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
459 |
|
|
|
460 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
461 |
|
|
{
|
462 |
|
|
/* Open the local endpoint as the sender. */
|
463 |
|
|
mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
|
464 |
|
|
mcapi_struct->local_endp, &request,
|
465 |
|
|
&mcapi_struct->status);
|
466 |
|
|
|
467 |
|
|
/* Check for the correct error. */
|
468 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
469 |
|
|
{
|
470 |
|
|
/* Wait for the open call to return successfully. */
|
471 |
|
|
mcapi_wait(&request, &rx_len,
|
472 |
|
|
&mcapi_struct->status, MCAPI_FTS_TIMEOUT);
|
473 |
|
|
|
474 |
|
|
/* Close the send side. */
|
475 |
|
|
mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
|
476 |
|
|
&request, &mcapi_struct->status);
|
477 |
|
|
|
478 |
|
|
if (mcapi_struct->status == MCAPI_SUCCESS)
|
479 |
|
|
{
|
480 |
|
|
/* Open the local endpoint again as the sender. */
|
481 |
|
|
mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
|
482 |
|
|
mcapi_struct->local_endp,
|
483 |
|
|
&request,
|
484 |
|
|
&mcapi_struct->status);
|
485 |
|
|
|
486 |
|
|
if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
|
487 |
|
|
{
|
488 |
|
|
mcapi_struct->status = MCAPI_SUCCESS;
|
489 |
|
|
|
490 |
|
|
/* Close the send side. */
|
491 |
|
|
mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
|
492 |
|
|
&mcapi_struct->request,
|
493 |
|
|
&status);
|
494 |
|
|
}
|
495 |
|
|
}
|
496 |
|
|
}
|
497 |
|
|
}
|
498 |
|
|
}
|
499 |
|
|
|
500 |
|
|
/* Set the state of the test to completed. */
|
501 |
|
|
mcapi_struct->state = 0;
|
502 |
|
|
|
503 |
|
|
/* Allow the next test to run. */
|
504 |
|
|
MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
|
505 |
|
|
|
506 |
|
|
} /* MCAPI_FTS_Tx_2_16_5 */
|