OpenCores
URL https://opencores.org/ocsvn/funbase_ip_library/funbase_ip_library/trunk

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.swp.api/] [openmcapi/] [1.0/] [test/] [func/] [fts_mcapi_wait_any.c] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
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_35_1
48
*
49
*   DESCRIPTION
50
*
51
*       Testing mcapi_wait_any while getting a foreign endpoint - timeout
52
*       occurs before endpoint created
53
*
54
*           Node 1 – Issue get endpoint request for non-existent endpoint
55
*                    on Node 0, wait for completion
56
*
57
*************************************************************************/
58
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_1)
59
{
60
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
61
    mcapi_endpoint_t    endpoint;
62
    size_t              rx_len;
63
    mcapi_status_t      status;
64
    mcapi_boolean_t     finished;
65
    mcapi_request_t     *req_ptr[1];
66
 
67
    /* Don't let any other test run while this test is running. */
68
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
69
 
70
    /* Get the foreign endpoint. */
71
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
72
                         &mcapi_struct->request, &mcapi_struct->status);
73
 
74
    if (mcapi_struct->status == MCAPI_SUCCESS)
75
    {
76
        req_ptr[0] = &mcapi_struct->request;
77
 
78
        /* Wait for the call to timeout. */
79
        finished = mcapi_wait_any(1, req_ptr, &rx_len, 250,
80
                                  &mcapi_struct->status);
81
 
82
        if (mcapi_struct->status == MCAPI_TIMEOUT)
83
        {
84
            mcapi_struct->status = MCAPI_SUCCESS;
85
        }
86
 
87
        else
88
        {
89
            mcapi_struct->status = -1;
90
        }
91
 
92
        /* Cancel the request. */
93
        mcapi_cancel(&mcapi_struct->request, &status);
94
    }
95
 
96
    /* Set the state of the test to completed. */
97
    mcapi_struct->state = 0;
98
 
99
    /* Allow the next test to run. */
100
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
101
 
102
} /* MCAPI_FTS_Tx_2_35_1 */
103
 
104
/************************************************************************
105
*
106
*   FUNCTION
107
*
108
*       MCAPI_FTS_Tx_2_35_2
109
*
110
*   DESCRIPTION
111
*
112
*       Testing mcapi_wait_any while getting a foreign endpoint - request
113
*       canceled
114
*
115
*           Node 1 – Issue get endpoint request for non-existent endpoint
116
*                    on Node 0, wait for completion, request canceled.
117
*
118
*************************************************************************/
119
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_2)
120
{
121
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
122
    mcapi_endpoint_t    endpoint = 0xffffffff;
123
    size_t              rx_len;
124
    mcapi_status_t      status;
125
    mcapi_boolean_t     finished;
126
    mcapi_request_t     *req_ptr[1];
127
 
128
    /* Don't let any other test run while this test is running. */
129
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
130
 
131
    /* Get the foreign endpoint. */
132
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
133
                         &mcapi_struct->request, &mcapi_struct->status);
134
 
135
    if (mcapi_struct->status == MCAPI_SUCCESS)
136
    {
137
        /* Indicate that the request should be canceled in 1000 milliseconds. */
138
        mcapi_struct->status =
139
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_CANCEL_REQUEST, 0,
140
                                   mcapi_struct->local_endp, 1000,
141
                                   MCAPI_DEFAULT_PRIO);
142
 
143
        req_ptr[0] = &mcapi_struct->request;
144
 
145
        /* Wait for the call to timeout. */
146
        finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
147
                                  &mcapi_struct->status);
148
 
149
        if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
150
             (finished == 0) )
151
        {
152
            mcapi_struct->status = MCAPI_SUCCESS;
153
        }
154
 
155
        else
156
        {
157
            mcapi_struct->status = -1;
158
        }
159
 
160
        /* Wait for a response that the cancel was successful. */
161
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
162
 
163
        if (status != MCAPI_SUCCESS)
164
        {
165
            mcapi_struct->status = -1;
166
        }
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_35_2 */
176
 
177
/************************************************************************
178
*
179
*   FUNCTION
180
*
181
*       MCAPI_FTS_Tx_2_35_3
182
*
183
*   DESCRIPTION
184
*
185
*       Testing mcapi_wait_any while getting a foreign endpoint - endpoint
186
*       retrieved
187
*
188
*           Node 0 – Wait for get endpoint request, create endpoint
189
*
190
*           Node 1 – Issue get endpoint request for non-existent endpoint
191
*                    on Node 0, wait for completion
192
*
193
*************************************************************************/
194
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_3)
195
{
196
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
197
    mcapi_endpoint_t    endpoint = 0xffffffff;
198
    size_t              rx_len;
199
    mcapi_status_t      status;
200
    mcapi_boolean_t     finished;
201
    mcapi_request_t     *req_ptr[1];
202
 
203
    /* Don't let any other test run while this test is running. */
204
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
205
 
206
    /* Get the foreign endpoint. */
207
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
208
                         &mcapi_struct->request, &mcapi_struct->status);
209
 
210
    if (mcapi_struct->status == MCAPI_SUCCESS)
211
    {
212
        /* Indicate that the endpoint should be created in 500 milliseconds. */
213
        mcapi_struct->status =
214
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
215
                                   mcapi_struct->local_endp, 500,
216
                                   MCAPI_DEFAULT_PRIO);
217
 
218
        req_ptr[0] = &mcapi_struct->request;
219
 
220
        /* Wait for the call to timeout. */
221
        finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
222
                                  &mcapi_struct->status);
223
 
224
        if ( (finished != 0) ||
225
             (mcapi_struct->status != MCAPI_SUCCESS) )
226
        {
227
            mcapi_struct->status = -1;
228
        }
229
 
230
        /* Wait for a response that the creation was successful. */
231
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
232
 
233
        if (status == MCAPI_SUCCESS)
234
        {
235
            /* Indicate that the endpoint should be deleted. */
236
            status =
237
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
238
                                       mcapi_struct->local_endp, 0,
239
                                       MCAPI_DEFAULT_PRIO);
240
 
241
            if (status == MCAPI_SUCCESS)
242
            {
243
                /* Wait for a response that the endpoint was deleted. */
244
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
245
            }
246
        }
247
    }
248
 
249
    /* Set the state of the test to completed. */
250
    mcapi_struct->state = 0;
251
 
252
    /* Allow the next test to run. */
253
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
254
 
255
} /* MCAPI_FTS_Tx_2_35_3 */
256
 
257
#ifdef LCL_MGMT_UNBROKEN
258
/************************************************************************
259
*
260
*   FUNCTION
261
*
262
*       MCAPI_FTS_Tx_2_35_4
263
*
264
*   DESCRIPTION
265
*
266
*       Testing mcapi_wait_any while getting a foreign endpoint - endpoint
267
*       retrieved, two requests outstanding
268
*
269
*           Node 0 – Wait for get endpoint request, create endpoint
270
*
271
*           Node 1 – Issue get endpoint request to Node 0, issue a second
272
*                    get from another thread, wait for completion by both
273
*
274
*************************************************************************/
275
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_4)
276
{
277
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
278
    mcapi_endpoint_t    endpoint = 0xffffffff;
279
    size_t              rx_len;
280
    mcapi_status_t      status;
281
    mcapi_boolean_t     finished;
282
    mcapi_request_t     *req_ptr[1];
283
 
284
    /* Don't let any other test run while this test is running. */
285
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
286
 
287
    /* Set up the structure for getting the local management server. */
288
    svc_struct.type = MCAPI_MSG_TX_TYPE;
289
    svc_struct.local_port = MCAPI_PORT_ANY;
290
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
291
    svc_struct.service = "lcl_mgmt";
292
    svc_struct.thread_entry = MCAPI_NULL;
293
 
294
    /* Create the client service. */
295
    MCAPID_Create_Service(&svc_struct);
296
 
297
    /* Get the foreign endpoint. */
298
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
299
                         &svc_struct.request, &mcapi_struct->status);
300
 
301
    if (mcapi_struct->status == MCAPI_SUCCESS)
302
    {
303
        /* Indicate that the thread should suspend on the request. */
304
        mcapi_struct->status =
305
            MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_WAIT_REQUEST, 0,
306
                                   svc_struct.local_endp, 0,
307
                                   MCAPI_DEFAULT_PRIO);
308
 
309
        if (mcapi_struct->status == MCAPI_SUCCESS)
310
        {
311
            /* Indicate that the endpoint should be created in 1000 milliseconds. */
312
            mcapi_struct->status =
313
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
314
                                       mcapi_struct->local_endp, 1000,
315
                                       MCAPI_DEFAULT_PRIO);
316
 
317
            if (mcapi_struct->status == MCAPI_SUCCESS)
318
            {
319
                req_ptr[0] = &svc_struct.request;
320
 
321
                /* Wait for the call to timeout. */
322
                finished = mcapi_wait_any(1, req_ptr, &rx_len,
323
                                          MCAPI_FTS_TIMEOUT,
324
                                          &mcapi_struct->status);
325
 
326
                if ( (finished != 0) ||
327
                     (mcapi_struct->status != MCAPI_SUCCESS) )
328
                {
329
                    mcapi_struct->status = -1;
330
                }
331
 
332
                /* Wait for a response that the wait was successful. */
333
                status = MCAPID_RX_Mgmt_Response(&svc_struct);
334
 
335
                /* Wait for a response that the creation was successful. */
336
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
337
 
338
                if (status == MCAPI_SUCCESS)
339
                {
340
                    /* Indicate that the endpoint should be deleted. */
341
                    status =
342
                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
343
                                               mcapi_struct->local_endp, 0,
344
                                               MCAPI_DEFAULT_PRIO);
345
 
346
                    if (status == MCAPI_SUCCESS)
347
                    {
348
                        /* Wait for a response that the endpoint was deleted. */
349
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
350
                    }
351
                }
352
            }
353
        }
354
    }
355
 
356
    /* Destroy the client service. */
357
    MCAPID_Destroy_Service(&svc_struct, 1);
358
 
359
    /* Set the state of the test to completed. */
360
    mcapi_struct->state = 0;
361
 
362
    /* Allow the next test to run. */
363
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
364
 
365
} /* MCAPI_FTS_Tx_2_35_4 */
366
#endif
367
 
368
/************************************************************************
369
*
370
*   FUNCTION
371
*
372
*       MCAPI_FTS_Tx_2_35_5
373
*
374
*   DESCRIPTION
375
*
376
*       Testing mcapi_wait_any for completed transmission using
377
*       mcapi_msg_send_i.
378
*
379
*           Node 0 – Create an endpoint, wait for data
380
*
381
*           Node 1 – Issue get endpoint request, transmit data, wait
382
*                    for completed transmission
383
*
384
*************************************************************************/
385
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_5)
386
{
387
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
388
    char                buffer[MCAPID_MSG_LEN];
389
    size_t              rx_len;
390
    mcapi_boolean_t     finished;
391
    mcapi_request_t     *req_ptr[1];
392
 
393
    /* Don't let any other test run while this test is running. */
394
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
395
 
396
    /* Store the endpoint to which the other side should reply. */
397
    mcapi_put32((unsigned char*)buffer, MCAPID_MGMT_LOCAL_ENDP_OFFSET, mcapi_struct->local_endp);
398
 
399
    /* Send a message. */
400
    mcapi_msg_send_i(mcapi_struct->local_endp, mcapi_struct->foreign_endp,
401
                     buffer, MCAPID_MSG_LEN, 0, &mcapi_struct->request,
402
                     &mcapi_struct->status);
403
 
404
    /* Wait for a response. */
405
    if (mcapi_struct->status == MCAPI_SUCCESS)
406
    {
407
        req_ptr[0] = &mcapi_struct->request;
408
 
409
        /* Wait for the call to timeout. */
410
        finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
411
                                  &mcapi_struct->status);
412
 
413
        /* If the test does not return success or the correct number of bytes
414
         * transmitted.
415
         */
416
        if ( (finished != 0) ||
417
             (mcapi_struct->status != MCAPI_SUCCESS) ||
418
             (rx_len != MCAPID_MSG_LEN) )
419
        {
420
            mcapi_struct->status = -1;
421
        }
422
    }
423
 
424
    /* Set the state of the test to completed. */
425
    mcapi_struct->state = 0;
426
 
427
    /* Allow the next test to run. */
428
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
429
 
430
} /* MCAPI_FTS_Tx_2_35_5 */
431
 
432
/************************************************************************
433
*
434
*   FUNCTION
435
*
436
*       MCAPI_FTS_Tx_2_35_6
437
*
438
*   DESCRIPTION
439
*
440
*       Testing mcapi_wait_any receiving data using mcapi_msg_recv_i -
441
*       incomplete.
442
*
443
*           Node 1 – Create endpoint, issue receive request, wait for
444
*                    timeout
445
*
446
*************************************************************************/
447
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_6)
448
{
449
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
450
    char                buffer[MCAPID_MGMT_PKT_LEN];
451
    size_t              rx_len;
452
    mcapi_boolean_t     finished;
453
    mcapi_request_t     *req_ptr[1];
454
 
455
    /* Don't let any other test run while this test is running. */
456
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
457
 
458
    /* Make the call to receive the data. */
459
    mcapi_msg_recv_i(mcapi_struct->local_endp, buffer, MCAPID_MGMT_PKT_LEN,
460
                     &mcapi_struct->request, &mcapi_struct->status);
461
 
462
    if (mcapi_struct->status == MCAPI_SUCCESS)
463
    {
464
        req_ptr[0] = &mcapi_struct->request;
465
 
466
        /* Wait for the call to timeout. */
467
        finished = mcapi_wait_any(1, req_ptr, &rx_len, 250,
468
                                  &mcapi_struct->status);
469
 
470
        if (mcapi_struct->status == MCAPI_TIMEOUT)
471
        {
472
            mcapi_struct->status = MCAPI_SUCCESS;
473
        }
474
 
475
        else
476
        {
477
            mcapi_struct->status = -1;
478
        }
479
    }
480
 
481
    /* Set the state of the test to completed. */
482
    mcapi_struct->state = 0;
483
 
484
    /* Allow the next test to run. */
485
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
486
 
487
} /* MCAPI_FTS_Tx_2_35_6 */
488
 
489
/************************************************************************
490
*
491
*   FUNCTION
492
*
493
*       MCAPI_FTS_Tx_2_35_7
494
*
495
*   DESCRIPTION
496
*
497
*       Testing mcapi_wait_any receiving data using mcapi_msg_recv_i -
498
*       complete.
499
*
500
*           Node 0 - Create endpoint, wait for other side to issue call
501
*                    to receive data, send data to Node 1.
502
*
503
*           Node 1 – Create endpoint, issue receive request, wait for
504
*                    completion.
505
*
506
*************************************************************************/
507
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_7)
508
{
509
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
510
    char                buffer[MCAPID_MGMT_PKT_LEN];
511
    size_t              rx_len;
512
    mcapi_status_t      status;
513
    mcapi_boolean_t     finished;
514
    mcapi_request_t     *req_ptr[1];
515
 
516
    /* Don't let any other test run while this test is running. */
517
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
518
 
519
    /* Indicate that a remote endpoint should be created for sending data
520
     * to this node.
521
     */
522
    mcapi_struct->status =
523
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
524
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
525
 
526
    /* Wait for a response. */
527
    if (mcapi_struct->status == MCAPI_SUCCESS)
528
    {
529
        /* Wait for the response. */
530
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
531
 
532
        /* If the endpoint was created. */
533
        if (mcapi_struct->status == MCAPI_SUCCESS)
534
        {
535
            /* Make the call to receive the data. */
536
            mcapi_msg_recv_i(mcapi_struct->local_endp, buffer, MCAPID_MGMT_PKT_LEN,
537
                             &mcapi_struct->request, &mcapi_struct->status);
538
 
539
            /* Cause the other side to send data. */
540
            mcapi_struct->status =
541
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_NO_OP, 1024,
542
                                       mcapi_struct->local_endp, 1000, MCAPI_DEFAULT_PRIO);
543
 
544
            if (mcapi_struct->status == MCAPI_SUCCESS)
545
            {
546
                req_ptr[0] = &mcapi_struct->request;
547
 
548
                /* Wait for the call to timeout. */
549
                finished = mcapi_wait_any(1, req_ptr, &rx_len,
550
                                          MCAPI_FTS_TIMEOUT,
551
                                          &mcapi_struct->status);
552
 
553
                if ( (finished != 0) ||
554
                     (mcapi_struct->status != MCAPI_SUCCESS) )
555
                {
556
                    mcapi_struct->status = -1;
557
                }
558
            }
559
 
560
            /* Tell the other side to delete the endpoint. */
561
            status =
562
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
563
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
564
 
565
            if (status == MCAPI_SUCCESS)
566
            {
567
                /* Wait for the response. */
568
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
569
            }
570
        }
571
    }
572
 
573
    /* Set the state of the test to completed. */
574
    mcapi_struct->state = 0;
575
 
576
    /* Allow the next test to run. */
577
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
578
 
579
} /* MCAPI_FTS_Tx_2_35_7 */
580
 
581
#ifdef LCL_MGMT_UNBROKEN
582
/************************************************************************
583
*
584
*   FUNCTION
585
*
586
*       MCAPI_FTS_Tx_2_35_8
587
*
588
*   DESCRIPTION
589
*
590
*       Testing mcapi_wait_any receiving data using mcapi_msg_recv_i -
591
*       call canceled.
592
*
593
*           Node 0 - Create endpoint, wait for other side to cancel call
594
*                    to receive data, send data to Node 1.
595
*
596
*           Node 1 – Create endpoint, issue receive request, cancel call,
597
*                    wait for completion.
598
*
599
*************************************************************************/
600
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_8)
601
{
602
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
603
    char                buffer[MCAPID_MGMT_PKT_LEN];
604
    size_t              rx_len;
605
    mcapi_status_t      status;
606
    mcapi_boolean_t     finished;
607
    mcapi_request_t     *req_ptr[1];
608
 
609
    /* Don't let any other test run while this test is running. */
610
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
611
 
612
    /* Set up the structure for getting the local management server. */
613
    svc_struct.type = MCAPI_MSG_TX_TYPE;
614
    svc_struct.local_port = MCAPI_PORT_ANY;
615
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
616
    svc_struct.service = "lcl_mgmt";
617
    svc_struct.thread_entry = MCAPI_NULL;
618
 
619
    /* Create the client service. */
620
    MCAPID_Create_Service(&svc_struct);
621
 
622
    /* Indicate that a remote endpoint should be created for sending data
623
     * to this node.
624
     */
625
    mcapi_struct->status =
626
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
627
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
628
 
629
    /* Wait for a response. */
630
    if (mcapi_struct->status == MCAPI_SUCCESS)
631
    {
632
        /* Wait for the response. */
633
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
634
 
635
        /* If the endpoint was created. */
636
        if (mcapi_struct->status == MCAPI_SUCCESS)
637
        {
638
            /* Make the call to receive the data. */
639
            mcapi_msg_recv_i(mcapi_struct->local_endp, buffer, MCAPID_MGMT_PKT_LEN,
640
                             &svc_struct.request, &mcapi_struct->status);
641
 
642
            /* Cause the call to be canceled. */
643
            mcapi_struct->status =
644
                MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
645
                                       svc_struct.local_endp, 1000, MCAPI_DEFAULT_PRIO);
646
 
647
            if (mcapi_struct->status == MCAPI_SUCCESS)
648
            {
649
                req_ptr[0] = &svc_struct.request;
650
 
651
                /* Wait for the call to timeout. */
652
                finished = mcapi_wait_any(1, req_ptr, &rx_len,
653
                                          MCAPI_FTS_TIMEOUT,
654
                                          &mcapi_struct->status);
655
 
656
                if ( (finished == 0) &&
657
                     (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) )
658
                {
659
                    mcapi_struct->status = MCAPI_SUCCESS;
660
                }
661
 
662
                else
663
                {
664
                    mcapi_struct->status = -1;
665
                }
666
            }
667
 
668
            /* Tell the other side to delete the endpoint. */
669
            status =
670
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
671
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
672
 
673
            if (status == MCAPI_SUCCESS)
674
            {
675
                /* Wait for the response. */
676
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
677
            }
678
        }
679
    }
680
 
681
    /* Destroy the client service. */
682
    MCAPID_Destroy_Service(&svc_struct, 1);
683
 
684
    /* Set the state of the test to completed. */
685
    mcapi_struct->state = 0;
686
 
687
    /* Allow the next test to run. */
688
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
689
 
690
} /* MCAPI_FTS_Tx_2_35_8 */
691
#endif
692
 
693
/************************************************************************
694
*
695
*   FUNCTION
696
*
697
*       MCAPI_FTS_Tx_2_35_9
698
*
699
*   DESCRIPTION
700
*
701
*       Testing mcapi_wait_any over mcapi_connect_pktchan_i - completed
702
*
703
*           Node 0 – Create an endpoint
704
*
705
*           Node 1 – Create an endpoint, get the endpoint on Node 0, issue
706
*                    connection, wait for completion
707
*
708
*************************************************************************/
709
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_9)
710
{
711
    MCAPID_STRUCT           *mcapi_struct = (MCAPID_STRUCT*)argv;
712
    size_t                  rx_len;
713
    mcapi_status_t          status;
714
    mcapi_endpoint_t        tx_endp, rx_endp;
715
    mcapi_boolean_t         finished;
716
    mcapi_request_t         *req_ptr[1];
717
 
718
    /* Don't let any other test run while this test is running. */
719
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
720
 
721
    /* An extra endpoint is required for the test. */
722
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
723
 
724
    if (mcapi_struct->status == MCAPI_SUCCESS)
725
    {
726
        /* Indicate that a remote endpoint should be created. */
727
        mcapi_struct->status =
728
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
729
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
730
 
731
        if (mcapi_struct->status == MCAPI_SUCCESS)
732
        {
733
            /* Wait for a response. */
734
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
735
 
736
            /* If the endpoint was created. */
737
            if (mcapi_struct->status == MCAPI_SUCCESS)
738
            {
739
                /* Get the foreign endpoint. */
740
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
741
 
742
                if (mcapi_struct->status == MCAPI_SUCCESS)
743
                {
744
                    /* Connect the two endpoints. */
745
                    mcapi_connect_pktchan_i(tx_endp, rx_endp,
746
                                            &mcapi_struct->request,
747
                                            &mcapi_struct->status);
748
 
749
                    if (mcapi_struct->status == MCAPI_SUCCESS)
750
                    {
751
                        req_ptr[0] = &mcapi_struct->request;
752
 
753
                        /* Wait for the call to timeout. */
754
                        finished = mcapi_wait_any(1, req_ptr, &rx_len,
755
                                                  MCAPI_FTS_TIMEOUT,
756
                                                  &mcapi_struct->status);
757
 
758
                        if ( (finished != 0) ||
759
                             (mcapi_struct->status != MCAPI_SUCCESS) )
760
                        {
761
                            mcapi_struct->status = -1;
762
                        }
763
                    }
764
                }
765
 
766
                /* Tell the other side to delete the endpoint. */
767
                status =
768
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
769
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
770
 
771
                if (status == MCAPI_SUCCESS)
772
                {
773
                    /* Wait for the response. */
774
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
775
                }
776
            }
777
        }
778
 
779
        /* Delete the extra endpoint. */
780
        mcapi_delete_endpoint(rx_endp, &status);
781
    }
782
 
783
    /* Set the state of the test to completed. */
784
    mcapi_struct->state = 0;
785
 
786
    /* Allow the next test to run. */
787
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
788
 
789
} /* MCAPI_FTS_Tx_2_35_9 */
790
 
791
/************************************************************************
792
*
793
*   FUNCTION
794
*
795
*       MCAPI_FTS_Tx_2_35_10
796
*
797
*   DESCRIPTION
798
*
799
*       Testing mcapi_wait_any over mcapi_open_pktchan_recv_i - timed out
800
*
801
*           Node 1 – Create endpoint, open receive side, wait for
802
*                    open to time out
803
*
804
*************************************************************************/
805
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_10)
806
{
807
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
808
    size_t              rx_len;
809
    mcapi_status_t      status;
810
    mcapi_boolean_t     finished;
811
    mcapi_request_t     *req_ptr[1];
812
 
813
    /* Don't let any other test run while this test is running. */
814
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
815
 
816
    /* Open the receive side. */
817
    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
818
                              mcapi_struct->local_endp,
819
                              &mcapi_struct->request,
820
                              &mcapi_struct->status);
821
 
822
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
823
    {
824
        req_ptr[0] = &mcapi_struct->request;
825
 
826
        /* Wait for the call to timeout. */
827
        finished = mcapi_wait_any(1, req_ptr, &rx_len, 250,
828
                                  &mcapi_struct->status);
829
 
830
        if (mcapi_struct->status == MCAPI_TIMEOUT)
831
        {
832
            mcapi_struct->status = MCAPI_SUCCESS;
833
        }
834
 
835
        else
836
        {
837
            mcapi_struct->status = -1;
838
        }
839
 
840
        mcapi_cancel(&mcapi_struct->request, &status);
841
    }
842
 
843
    /* Set the state of the test to completed. */
844
    mcapi_struct->state = 0;
845
 
846
    /* Allow the next test to run. */
847
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
848
 
849
} /* MCAPI_FTS_Tx_2_35_10 */
850
 
851
/************************************************************************
852
*
853
*   FUNCTION
854
*
855
*       MCAPI_FTS_Tx_2_35_11
856
*
857
*   DESCRIPTION
858
*
859
*       Testing mcapi_wait_any over mcapi_open_pktchan_recv_i - complete
860
*
861
*           Node 0 - Create endpoint, open send side.
862
*
863
*           Node 1 – Create endpoint, connect, open receive side, wait for
864
*                    completion.
865
*
866
*************************************************************************/
867
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_11)
868
{
869
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
870
    size_t              rx_len;
871
    mcapi_status_t      status;
872
    mcapi_boolean_t     finished;
873
    mcapi_request_t     request;
874
    mcapi_endpoint_t    tx_endp;
875
    mcapi_request_t     *req_ptr[1];
876
 
877
    /* Don't let any other test run while this test is running. */
878
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
879
 
880
    /* Indicate that a remote endpoint should be created. */
881
    mcapi_struct->status =
882
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
883
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
884
 
885
    if (mcapi_struct->status == MCAPI_SUCCESS)
886
    {
887
        /* Wait for the response. */
888
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
889
 
890
        /* If the endpoint was created. */
891
        if (mcapi_struct->status == MCAPI_SUCCESS)
892
        {
893
            /* Indicate that the endpoint should be opened as a sender. */
894
            mcapi_struct->status =
895
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
896
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
897
 
898
            /* Wait for the response. */
899
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
900
 
901
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
902
            {
903
                /* Get the foreign endpoint. */
904
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
905
 
906
                if (mcapi_struct->status == MCAPI_SUCCESS)
907
                {
908
                    /* Connect two endpoints. */
909
                    mcapi_connect_pktchan_i(tx_endp, mcapi_struct->local_endp,
910
                                            &mcapi_struct->request,
911
                                            &mcapi_struct->status);
912
 
913
                    if (mcapi_struct->status == MCAPI_SUCCESS)
914
                    {
915
                        /* Open the receive side. */
916
                        mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
917
                                                  mcapi_struct->local_endp,
918
                                                  &request, &mcapi_struct->status);
919
 
920
                        req_ptr[0] = &request;
921
 
922
                        /* Wait for the call to timeout. */
923
                        finished = mcapi_wait_any(1, req_ptr, &rx_len,
924
                                                  MCAPI_FTS_TIMEOUT,
925
                                                  &mcapi_struct->status);
926
 
927
                        if ( (finished != 0) ||
928
                             (mcapi_struct->status != MCAPI_SUCCESS) )
929
                        {
930
                            mcapi_struct->status = -1;
931
                        }
932
 
933
                        /* Close the receive side. */
934
                        mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
935
                                                      &request, &status);
936
                    }
937
                }
938
 
939
                /* Tell the other side to close the send side. */
940
                status =
941
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
942
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
943
                                           1024, mcapi_struct->local_endp,
944
                                           0, MCAPI_DEFAULT_PRIO);
945
 
946
                if (status == MCAPI_SUCCESS)
947
                {
948
                    /* Wait for the response. */
949
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
950
                }
951
            }
952
 
953
            /* Tell the other side to delete the endpoint. */
954
            status =
955
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
956
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
957
 
958
            if (status == MCAPI_SUCCESS)
959
            {
960
                /* Wait for the response. */
961
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
962
            }
963
        }
964
    }
965
 
966
    /* Set the state of the test to completed. */
967
    mcapi_struct->state = 0;
968
 
969
    /* Allow the next test to run. */
970
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
971
 
972
} /* MCAPI_FTS_Tx_2_35_11 */
973
 
974
#ifdef LCL_MGMT_UNBROKEN
975
/************************************************************************
976
*
977
*   FUNCTION
978
*
979
*       MCAPI_FTS_Tx_2_35_12
980
*
981
*   DESCRIPTION
982
*
983
*       Testing mcapi_wait_any over mcapi_open_pktchan_recv_i - canceled
984
*
985
*           Node 1 – Create endpoint, open receive side, cancel, wait for
986
*                    completion.
987
*
988
*************************************************************************/
989
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_12)
990
{
991
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
992
    size_t              rx_len;
993
    mcapi_boolean_t     finished;
994
    mcapi_request_t     *req_ptr[1];
995
 
996
    /* Don't let any other test run while this test is running. */
997
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
998
 
999
    /* Set up the structure for getting the local management server. */
1000
    svc_struct.type = MCAPI_MSG_TX_TYPE;
1001
    svc_struct.local_port = MCAPI_PORT_ANY;
1002
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
1003
    svc_struct.service = "lcl_mgmt";
1004
    svc_struct.thread_entry = MCAPI_NULL;
1005
 
1006
    /* Create the client service that will cancel the call. */
1007
    MCAPID_Create_Service(&svc_struct);
1008
 
1009
    /* Open the receive side. */
1010
    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1011
                              mcapi_struct->local_endp,
1012
                              &svc_struct.request,
1013
                              &mcapi_struct->status);
1014
 
1015
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1016
    {
1017
        /* Cause the call to be canceled in 1 second. */
1018
        mcapi_struct->status =
1019
            MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
1020
                                   svc_struct.local_endp, 1000, MCAPI_DEFAULT_PRIO);
1021
 
1022
        if (mcapi_struct->status == MCAPI_SUCCESS)
1023
        {
1024
            req_ptr[0] = &svc_struct.request;
1025
 
1026
            /* Wait for the call to timeout. */
1027
            finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
1028
                                      &mcapi_struct->status);
1029
 
1030
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
1031
                 (finished == 0) )
1032
            {
1033
                mcapi_struct->status = MCAPI_SUCCESS;
1034
            }
1035
 
1036
            else
1037
            {
1038
                mcapi_struct->status = -1;
1039
            }
1040
        }
1041
    }
1042
 
1043
    /* Destroy the client service. */
1044
    MCAPID_Destroy_Service(&svc_struct, 1);
1045
 
1046
    /* Set the state of the test to completed. */
1047
    mcapi_struct->state = 0;
1048
 
1049
    /* Allow the next test to run. */
1050
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1051
 
1052
} /* MCAPI_FTS_Tx_2_35_12 */
1053
#endif
1054
 
1055
/************************************************************************
1056
*
1057
*   FUNCTION
1058
*
1059
*       MCAPI_FTS_Tx_2_35_13
1060
*
1061
*   DESCRIPTION
1062
*
1063
*       Testing mcapi_wait_any over mcapi_open_pktchan_send_i - timed out
1064
*
1065
*           Node 1 – Create endpoint, open send side, wait for
1066
*                    open to time out
1067
*
1068
*************************************************************************/
1069
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_13)
1070
{
1071
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1072
    size_t              rx_len;
1073
    mcapi_status_t      status;
1074
    mcapi_boolean_t     finished;
1075
    mcapi_request_t     *req_ptr[1];
1076
 
1077
    /* Don't let any other test run while this test is running. */
1078
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1079
 
1080
    /* Open the send side. */
1081
    mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
1082
                              mcapi_struct->local_endp,
1083
                              &mcapi_struct->request,
1084
                              &mcapi_struct->status);
1085
 
1086
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1087
    {
1088
        req_ptr[0] = &mcapi_struct->request;
1089
 
1090
        /* Wait for the call to timeout. */
1091
        finished = mcapi_wait_any(1, req_ptr, &rx_len, 250,
1092
                                  &mcapi_struct->status);
1093
 
1094
        if (mcapi_struct->status == MCAPI_TIMEOUT)
1095
        {
1096
            mcapi_struct->status = MCAPI_SUCCESS;
1097
        }
1098
 
1099
        else
1100
        {
1101
            mcapi_struct->status = -1;
1102
        }
1103
 
1104
        mcapi_cancel(&mcapi_struct->request, &status);
1105
    }
1106
 
1107
    /* Set the state of the test to completed. */
1108
    mcapi_struct->state = 0;
1109
 
1110
    /* Allow the next test to run. */
1111
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1112
 
1113
} /* MCAPI_FTS_Tx_2_35_13 */
1114
 
1115
/************************************************************************
1116
*
1117
*   FUNCTION
1118
*
1119
*       MCAPI_FTS_Tx_2_35_14
1120
*
1121
*   DESCRIPTION
1122
*
1123
*       Testing mcapi_wait_any over mcapi_open_pktchan_send_i - complete
1124
*
1125
*           Node 0 - Create endpoint, open receive side.
1126
*
1127
*           Node 1 – Create endpoint, connect, open send side, wait for
1128
*                    completion.
1129
*
1130
*************************************************************************/
1131
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_14)
1132
{
1133
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1134
    size_t              rx_len;
1135
    mcapi_status_t      status;
1136
    mcapi_boolean_t     finished;
1137
    mcapi_request_t     request;
1138
    mcapi_endpoint_t    rx_endp;
1139
    mcapi_request_t     *req_ptr[1];
1140
 
1141
    /* Don't let any other test run while this test is running. */
1142
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1143
 
1144
    /* Indicate that a remote endpoint should be created. */
1145
    mcapi_struct->status =
1146
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1147
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1148
 
1149
    if (mcapi_struct->status == MCAPI_SUCCESS)
1150
    {
1151
        /* Wait for the response. */
1152
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1153
 
1154
        /* If the endpoint was created. */
1155
        if (mcapi_struct->status == MCAPI_SUCCESS)
1156
        {
1157
            /* Indicate that the endpoint should be opened as a receiver. */
1158
            mcapi_struct->status =
1159
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_PKT,
1160
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1161
 
1162
            /* Wait for the response. */
1163
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1164
 
1165
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1166
            {
1167
                /* Get the foreign endpoint. */
1168
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1169
 
1170
                if (mcapi_struct->status == MCAPI_SUCCESS)
1171
                {
1172
                    /* Connect two endpoints. */
1173
                    mcapi_connect_pktchan_i(mcapi_struct->local_endp, rx_endp,
1174
                                            &mcapi_struct->request,
1175
                                            &mcapi_struct->status);
1176
 
1177
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1178
                    {
1179
                        /* Open the send side. */
1180
                        mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
1181
                                                  mcapi_struct->local_endp,
1182
                                                  &request, &mcapi_struct->status);
1183
 
1184
                        req_ptr[0] = &request;
1185
 
1186
                        /* Wait for the call to timeout. */
1187
                        finished = mcapi_wait_any(1, req_ptr, &rx_len,
1188
                                                  MCAPI_FTS_TIMEOUT,
1189
                                                  &mcapi_struct->status);
1190
 
1191
                        if ( (finished != 0) ||
1192
                             (mcapi_struct->status != MCAPI_SUCCESS) )
1193
                        {
1194
                            mcapi_struct->status = -1;
1195
                        }
1196
 
1197
                        /* Close the send side. */
1198
                        mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
1199
                                                      &request, &status);
1200
                    }
1201
                }
1202
 
1203
                /* Tell the other side to close the receive side. */
1204
                status =
1205
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
1206
                                           MCAPID_MGMT_CLOSE_RX_SIDE_PKT,
1207
                                           1024, mcapi_struct->local_endp,
1208
                                           0, MCAPI_DEFAULT_PRIO);
1209
 
1210
                if (status == MCAPI_SUCCESS)
1211
                {
1212
                    /* Wait for the response. */
1213
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1214
                }
1215
            }
1216
 
1217
            /* Tell the other side to delete the endpoint. */
1218
            status =
1219
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1220
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1221
 
1222
            if (status == MCAPI_SUCCESS)
1223
            {
1224
                /* Wait for the response. */
1225
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1226
            }
1227
        }
1228
    }
1229
 
1230
    /* Set the state of the test to completed. */
1231
    mcapi_struct->state = 0;
1232
 
1233
    /* Allow the next test to run. */
1234
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1235
 
1236
} /* MCAPI_FTS_Tx_2_35_14 */
1237
 
1238
#ifdef LCL_MGMT_UNBROKEN
1239
/************************************************************************
1240
*
1241
*   FUNCTION
1242
*
1243
*       MCAPI_FTS_Tx_2_35_15
1244
*
1245
*   DESCRIPTION
1246
*
1247
*       Testing mcapi_wait_any over mcapi_open_pktchan_send_i - canceled
1248
*
1249
*           Node 1 – Create endpoint, open send side, cancel, wait for
1250
*                    completion.
1251
*
1252
*************************************************************************/
1253
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_15)
1254
{
1255
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
1256
    size_t              rx_len;
1257
    mcapi_boolean_t     finished;
1258
    mcapi_request_t     *req_ptr[1];
1259
 
1260
    /* Don't let any other test run while this test is running. */
1261
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1262
 
1263
    /* Set up the structure for getting the local management server. */
1264
    svc_struct.type = MCAPI_MSG_TX_TYPE;
1265
    svc_struct.local_port = MCAPI_PORT_ANY;
1266
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
1267
    svc_struct.service = "lcl_mgmt";
1268
    svc_struct.thread_entry = MCAPI_NULL;
1269
 
1270
    /* Create the client service that will cancel the call. */
1271
    MCAPID_Create_Service(&svc_struct);
1272
 
1273
    /* Open the send side. */
1274
    mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
1275
                              mcapi_struct->local_endp,
1276
                              &svc_struct.request,
1277
                              &mcapi_struct->status);
1278
 
1279
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1280
    {
1281
        /* Cause the call to be canceled in 1 second. */
1282
        mcapi_struct->status =
1283
            MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
1284
                                   svc_struct.local_endp, 1000, MCAPI_DEFAULT_PRIO);
1285
 
1286
        if (mcapi_struct->status == MCAPI_SUCCESS)
1287
        {
1288
            req_ptr[0] = &svc_struct.request;
1289
 
1290
            /* Wait for the call to timeout. */
1291
            finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
1292
                                      &mcapi_struct->status);
1293
 
1294
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
1295
                 (finished == 0) )
1296
            {
1297
                mcapi_struct->status = MCAPI_SUCCESS;
1298
            }
1299
 
1300
            else
1301
            {
1302
                mcapi_struct->status = -1;
1303
            }
1304
        }
1305
    }
1306
 
1307
    /* Destroy the client service. */
1308
    MCAPID_Destroy_Service(&svc_struct, 1);
1309
 
1310
    /* Set the state of the test to completed. */
1311
    mcapi_struct->state = 0;
1312
 
1313
    /* Allow the next test to run. */
1314
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1315
 
1316
} /* MCAPI_FTS_Tx_2_35_15 */
1317
#endif
1318
 
1319
/************************************************************************
1320
*
1321
*   FUNCTION
1322
*
1323
*       MCAPI_FTS_Tx_2_35_16
1324
*
1325
*   DESCRIPTION
1326
*
1327
*       Testing mcapi_wait_any over mcapi_pktchan_send_i - complete
1328
*
1329
*           Node 0 - Create endpoint, open receive side, wait for data.
1330
*
1331
*           Node 1 – Create endpoint, open send side, connect, send data,
1332
*                    wait for completion.
1333
*
1334
*************************************************************************/
1335
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_16)
1336
{
1337
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1338
    size_t              rx_len;
1339
    mcapi_boolean_t     finished;
1340
    char                buffer[MCAPID_MSG_LEN];
1341
    mcapi_status_t      status;
1342
    mcapi_request_t     *req_ptr[1];
1343
 
1344
    /* Don't let any other test run while this test is running. */
1345
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1346
 
1347
    /* Send some data. */
1348
    mcapi_pktchan_send_i(mcapi_struct->pkt_tx_handle, buffer, MCAPID_MSG_LEN,
1349
                         &mcapi_struct->request, &mcapi_struct->status);
1350
 
1351
    if (mcapi_struct->status == MCAPI_SUCCESS)
1352
    {
1353
        req_ptr[0] = &mcapi_struct->request;
1354
 
1355
        /* Wait for the call to timeout. */
1356
        finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
1357
                                  &mcapi_struct->status);
1358
 
1359
        if ( (finished != 0) ||
1360
             (mcapi_struct->status != MCAPI_SUCCESS) ||
1361
             (rx_len != MCAPID_MSG_LEN) )
1362
        {
1363
            mcapi_struct->status = -1;
1364
        }
1365
    }
1366
 
1367
    /* Close the send side. */
1368
    mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
1369
                                  &mcapi_struct->request, &status);
1370
 
1371
    /* Set the state of the test to completed. */
1372
    mcapi_struct->state = 0;
1373
 
1374
    /* Allow the next test to run. */
1375
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1376
 
1377
} /* MCAPI_FTS_Tx_2_35_16 */
1378
 
1379
/************************************************************************
1380
*
1381
*   FUNCTION
1382
*
1383
*       MCAPI_FTS_Tx_2_35_17
1384
*
1385
*   DESCRIPTION
1386
*
1387
*       Testing mcapi_wait_any over mcapi_pktchan_recv_i - timed out
1388
*
1389
*           Node 0 - Create endpoint, open send side.
1390
*
1391
*           Node 1 – Create endpoint, connect, open receive side, issue
1392
*                    receive call, wait for completion.
1393
*
1394
*************************************************************************/
1395
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_17)
1396
{
1397
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1398
    size_t              rx_len;
1399
    mcapi_status_t      status;
1400
    mcapi_boolean_t     finished;
1401
    mcapi_request_t     request;
1402
    mcapi_endpoint_t    tx_endp;
1403
    char                *buffer;
1404
    mcapi_request_t     *req_ptr[1];
1405
 
1406
    /* Don't let any other test run while this test is running. */
1407
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1408
 
1409
    /* Indicate that a remote endpoint should be created. */
1410
    mcapi_struct->status =
1411
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1412
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1413
 
1414
    if (mcapi_struct->status == MCAPI_SUCCESS)
1415
    {
1416
        /* Wait for the response. */
1417
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1418
 
1419
        /* If the endpoint was created. */
1420
        if (mcapi_struct->status == MCAPI_SUCCESS)
1421
        {
1422
            /* Indicate that the endpoint should be opened as a sender. */
1423
            mcapi_struct->status =
1424
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1425
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1426
 
1427
            /* Wait for the response. */
1428
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1429
 
1430
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1431
            {
1432
                /* Get the foreign endpoint. */
1433
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1434
 
1435
                if (mcapi_struct->status == MCAPI_SUCCESS)
1436
                {
1437
                    /* Connect two endpoints. */
1438
                    mcapi_connect_pktchan_i(tx_endp, mcapi_struct->local_endp,
1439
                                            &mcapi_struct->request,
1440
                                            &mcapi_struct->status);
1441
 
1442
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1443
                    {
1444
                        /* Open the receive side. */
1445
                        mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1446
                                                  mcapi_struct->local_endp,
1447
                                                  &request, &mcapi_struct->status);
1448
 
1449
                        /* Wait for the receive side to open. */
1450
                        mcapi_wait(&request, &rx_len, &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1451
 
1452
                        if (mcapi_struct->status == MCAPI_SUCCESS)
1453
                        {
1454
                            /* Issue a receive call. */
1455
                            mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
1456
                                                 (void**)&buffer, &mcapi_struct->request,
1457
                                                 &mcapi_struct->status);
1458
 
1459
                            if (mcapi_struct->status == MCAPI_SUCCESS)
1460
                            {
1461
                                req_ptr[0] = &mcapi_struct->request;
1462
 
1463
                                /* Wait for the call to timeout. */
1464
                                finished = mcapi_wait_any(1, req_ptr,
1465
                                                          &rx_len, 250,
1466
                                                          &mcapi_struct->status);
1467
 
1468
                                if (mcapi_struct->status == MCAPI_TIMEOUT)
1469
                                {
1470
                                    mcapi_struct->status = MCAPI_SUCCESS;
1471
                                }
1472
 
1473
                                else
1474
                                {
1475
                                    mcapi_struct->status = -1;
1476
                                }
1477
 
1478
                                /* Cancel the receive call. */
1479
                                mcapi_cancel(&mcapi_struct->request, &status);
1480
                            }
1481
 
1482
                            /* Close the receive side. */
1483
                            mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1484
                                                          &request, &status);
1485
                        }
1486
                    }
1487
                }
1488
 
1489
                /* Tell the other side to close the send side. */
1490
                status =
1491
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
1492
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
1493
                                           1024, mcapi_struct->local_endp,
1494
                                           0, MCAPI_DEFAULT_PRIO);
1495
 
1496
                if (status == MCAPI_SUCCESS)
1497
                {
1498
                    /* Wait for the response. */
1499
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1500
                }
1501
            }
1502
 
1503
            /* Tell the other side to delete the endpoint. */
1504
            status =
1505
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1506
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1507
 
1508
            if (status == MCAPI_SUCCESS)
1509
            {
1510
                /* Wait for the response. */
1511
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1512
            }
1513
        }
1514
    }
1515
 
1516
    /* Set the state of the test to completed. */
1517
    mcapi_struct->state = 0;
1518
 
1519
    /* Allow the next test to run. */
1520
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1521
 
1522
} /* MCAPI_FTS_Tx_2_35_17 */
1523
 
1524
/************************************************************************
1525
*
1526
*   FUNCTION
1527
*
1528
*       MCAPI_FTS_Tx_2_35_18
1529
*
1530
*   DESCRIPTION
1531
*
1532
*       Testing mcapi_wait_any over mcapi_pktchan_recv_i - complete
1533
*
1534
*           Node 0 - Create endpoint, open send side, send data.
1535
*
1536
*           Node 1 – Create endpoint, connect, open receive side, issue
1537
*                    receive call, wait for completion.
1538
*
1539
*************************************************************************/
1540
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_18)
1541
{
1542
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1543
    size_t              rx_len;
1544
    mcapi_status_t      status;
1545
    mcapi_boolean_t     finished;
1546
    mcapi_request_t     request;
1547
    mcapi_endpoint_t    tx_endp, rx_endp;
1548
    char                *buffer;
1549
    mcapi_request_t     *req_ptr[1];
1550
 
1551
    /* Don't let any other test run while this test is running. */
1552
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1553
 
1554
    /* This test requires an extra endpoint. */
1555
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
1556
 
1557
    if (mcapi_struct->status == MCAPI_SUCCESS)
1558
    {
1559
        /* Indicate that a remote endpoint should be created. */
1560
        mcapi_struct->status =
1561
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1562
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1563
 
1564
        if (mcapi_struct->status == MCAPI_SUCCESS)
1565
        {
1566
            /* Wait for the response. */
1567
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1568
 
1569
            /* If the endpoint was created. */
1570
            if (mcapi_struct->status == MCAPI_SUCCESS)
1571
            {
1572
                /* Indicate that the endpoint should be opened as a sender. */
1573
                mcapi_struct->status =
1574
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1575
                                           1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1576
 
1577
                /* Wait for the response. */
1578
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1579
 
1580
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1581
                {
1582
                    /* Get the foreign endpoint. */
1583
                    tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1584
 
1585
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1586
                    {
1587
                        /* Connect two endpoints. */
1588
                        mcapi_connect_pktchan_i(tx_endp, rx_endp,
1589
                                                &mcapi_struct->request,
1590
                                                &mcapi_struct->status);
1591
 
1592
                        if (mcapi_struct->status == MCAPI_SUCCESS)
1593
                        {
1594
                            mcapi_wait(&mcapi_struct->request, &rx_len,
1595
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1596
 
1597
                            /* Open the receive side. */
1598
                            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1599
                                                      rx_endp, &request,
1600
                                                      &mcapi_struct->status);
1601
 
1602
                            /* Wait for the receive side to open. */
1603
                            mcapi_wait(&request, &rx_len, &mcapi_struct->status,
1604
                                       MCAPI_FTS_TIMEOUT);
1605
 
1606
                            if (mcapi_struct->status == MCAPI_SUCCESS)
1607
                            {
1608
                                /* Issue a receive call. */
1609
                                mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
1610
                                                     (void**)&buffer,
1611
                                                     &mcapi_struct->request,
1612
                                                     &mcapi_struct->status);
1613
 
1614
                                if (mcapi_struct->status == MCAPI_SUCCESS)
1615
                                {
1616
                                    /* Tell the other side to send some data. */
1617
                                    mcapi_struct->status =
1618
                                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_TX_PKT,
1619
                                                               1024, mcapi_struct->local_endp,
1620
                                                               1000, MCAPI_DEFAULT_PRIO);
1621
 
1622
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
1623
                                    {
1624
                                        /* Wait for the response. */
1625
                                        mcapi_struct->status =
1626
                                            MCAPID_RX_Mgmt_Response(mcapi_struct);
1627
 
1628
                                        if (mcapi_struct->status == MCAPI_SUCCESS)
1629
                                        {
1630
                                            req_ptr[0] = &mcapi_struct->request;
1631
 
1632
                                            /* Wait for the call to timeout. */
1633
                                            finished = mcapi_wait_any(1,
1634
                                                                      req_ptr,
1635
                                                                      &rx_len,
1636
                                                                      MCAPI_FTS_TIMEOUT,
1637
                                                                      &mcapi_struct->status);
1638
 
1639
                                            if ( (finished != 0) ||
1640
                                                 (mcapi_struct->status != MCAPI_SUCCESS) )
1641
                                            {
1642
                                                mcapi_struct->status = -1;
1643
                                            }
1644
 
1645
                                            /* The buffer must be freed. */
1646
                                            else
1647
                                            {
1648
                                                mcapi_pktchan_free(buffer, &status);
1649
                                            }
1650
                                        }
1651
                                    }
1652
                                }
1653
 
1654
                                /* Close the receive side. */
1655
                                mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1656
                                                              &request, &status);
1657
                            }
1658
                        }
1659
                    }
1660
 
1661
                    /* Tell the other side to close the send side. */
1662
                    status =
1663
                        MCAPID_TX_Mgmt_Message(mcapi_struct,
1664
                                               MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
1665
                                               1024, mcapi_struct->local_endp,
1666
                                               0, MCAPI_DEFAULT_PRIO);
1667
 
1668
                    if (status == MCAPI_SUCCESS)
1669
                    {
1670
                        /* Wait for the response. */
1671
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1672
                    }
1673
                }
1674
 
1675
                /* Tell the other side to delete the endpoint. */
1676
                status =
1677
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1678
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1679
 
1680
                if (status == MCAPI_SUCCESS)
1681
                {
1682
                    /* Wait for the response. */
1683
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1684
                }
1685
            }
1686
        }
1687
 
1688
        /* Delete the extra endpoint. */
1689
        mcapi_delete_endpoint(rx_endp, &status);
1690
    }
1691
 
1692
    /* Set the state of the test to completed. */
1693
    mcapi_struct->state = 0;
1694
 
1695
    /* Allow the next test to run. */
1696
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1697
 
1698
} /* MCAPI_FTS_Tx_2_35_18 */
1699
 
1700
#ifdef LCL_MGMT_UNBROKEN
1701
/************************************************************************
1702
*
1703
*   FUNCTION
1704
*
1705
*       MCAPI_FTS_Tx_2_35_19
1706
*
1707
*   DESCRIPTION
1708
*
1709
*       Testing mcapi_wait_any over mcapi_pktchan_recv_i - canceled
1710
*
1711
*           Node 0 - Create endpoint, open send side.
1712
*
1713
*           Node 1 – Create endpoint, connect, open receive side, issue
1714
*                    receive call, cancel receive call, wait for completion.
1715
*
1716
*************************************************************************/
1717
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_19)
1718
{
1719
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
1720
    size_t              rx_len;
1721
    mcapi_status_t      status;
1722
    mcapi_boolean_t     finished;
1723
    mcapi_request_t     request;
1724
    mcapi_endpoint_t    tx_endp, rx_endp;
1725
    char                *buffer;
1726
    mcapi_request_t     *req_ptr[1];
1727
 
1728
    /* Don't let any other test run while this test is running. */
1729
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1730
 
1731
    /* Set up the structure for getting the local management server. */
1732
    svc_struct.type = MCAPI_MSG_TX_TYPE;
1733
    svc_struct.local_port = MCAPI_PORT_ANY;
1734
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
1735
    svc_struct.service = "lcl_mgmt";
1736
    svc_struct.thread_entry = MCAPI_NULL;
1737
 
1738
    /* Create the client service that will cancel the call. */
1739
    MCAPID_Create_Service(&svc_struct);
1740
 
1741
    /* This test requires an extra endpoint. */
1742
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
1743
 
1744
    if (mcapi_struct->status == MCAPI_SUCCESS)
1745
    {
1746
        /* Indicate that a remote endpoint should be created. */
1747
        mcapi_struct->status =
1748
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1749
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1750
 
1751
        if (mcapi_struct->status == MCAPI_SUCCESS)
1752
        {
1753
            /* Wait for the response. */
1754
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1755
 
1756
            /* If the endpoint was created. */
1757
            if (mcapi_struct->status == MCAPI_SUCCESS)
1758
            {
1759
                /* Indicate that the endpoint should be opened as a sender. */
1760
                mcapi_struct->status =
1761
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1762
                                           1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1763
 
1764
                /* Wait for the response. */
1765
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1766
 
1767
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1768
                {
1769
                    /* Get the foreign endpoint. */
1770
                    tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1771
 
1772
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1773
                    {
1774
                        /* Connect two endpoints. */
1775
                        mcapi_connect_pktchan_i(tx_endp, rx_endp,
1776
                                                &mcapi_struct->request,
1777
                                                &mcapi_struct->status);
1778
 
1779
                        if (mcapi_struct->status == MCAPI_SUCCESS)
1780
                        {
1781
                            mcapi_wait(&mcapi_struct->request, &rx_len,
1782
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1783
 
1784
                            /* Open the receive side. */
1785
                            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1786
                                                      rx_endp, &request,
1787
                                                      &mcapi_struct->status);
1788
 
1789
                            /* Wait for the receive side to open. */
1790
                            mcapi_wait(&request, &rx_len, &mcapi_struct->status,
1791
                                       MCAPI_FTS_TIMEOUT);
1792
 
1793
                            if (mcapi_struct->status == MCAPI_SUCCESS)
1794
                            {
1795
                                /* Issue a receive call. */
1796
                                mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
1797
                                                     (void**)&buffer,
1798
                                                     &svc_struct.request,
1799
                                                     &mcapi_struct->status);
1800
 
1801
                                if (mcapi_struct->status == MCAPI_SUCCESS)
1802
                                {
1803
                                    /* Cause the call to be canceled in 1 second. */
1804
                                    mcapi_struct->status =
1805
                                        MCAPID_TX_Mgmt_Message(&svc_struct,
1806
                                                               MCAPID_CANCEL_REQUEST, 0,
1807
                                                               svc_struct.local_endp, 1000,
1808
                                                               MCAPI_DEFAULT_PRIO);
1809
 
1810
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
1811
                                    {
1812
                                        req_ptr[0] = &svc_struct.request;
1813
 
1814
                                        /* Wait for the call to timeout. */
1815
                                        finished = mcapi_wait_any(1, req_ptr,
1816
                                                                  &rx_len,
1817
                                                                  MCAPI_FTS_TIMEOUT,
1818
                                                                  &mcapi_struct->status);
1819
 
1820
                                        if ( (finished != 0) ||
1821
                                             (mcapi_struct->status != MCAPI_ERR_REQUEST_CANCELLED) )
1822
                                        {
1823
                                            mcapi_struct->status = -1;
1824
                                        }
1825
 
1826
                                        else
1827
                                        {
1828
                                            mcapi_struct->status = MCAPI_SUCCESS;
1829
                                        }
1830
                                    }
1831
                                }
1832
 
1833
                                /* Close the receive side. */
1834
                                mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1835
                                                              &request, &status);
1836
                            }
1837
                        }
1838
                    }
1839
 
1840
                    /* Tell the other side to close the send side. */
1841
                    status =
1842
                        MCAPID_TX_Mgmt_Message(mcapi_struct,
1843
                                               MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
1844
                                               1024, mcapi_struct->local_endp,
1845
                                               0, MCAPI_DEFAULT_PRIO);
1846
 
1847
                    if (status == MCAPI_SUCCESS)
1848
                    {
1849
                        /* Wait for the response. */
1850
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1851
                    }
1852
                }
1853
 
1854
                /* Tell the other side to delete the endpoint. */
1855
                status =
1856
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1857
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1858
 
1859
                if (status == MCAPI_SUCCESS)
1860
                {
1861
                    /* Wait for the response. */
1862
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1863
                }
1864
            }
1865
        }
1866
 
1867
        /* Delete the extra endpoint. */
1868
        mcapi_delete_endpoint(rx_endp, &status);
1869
    }
1870
 
1871
    /* Destroy the client service that will cancel the call. */
1872
    MCAPID_Destroy_Service(&svc_struct, 1);
1873
 
1874
    /* Set the state of the test to completed. */
1875
    mcapi_struct->state = 0;
1876
 
1877
    /* Allow the next test to run. */
1878
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1879
 
1880
} /* MCAPI_FTS_Tx_2_35_19 */
1881
#endif
1882
 
1883
/************************************************************************
1884
*
1885
*   FUNCTION
1886
*
1887
*       MCAPI_FTS_Tx_2_35_20
1888
*
1889
*   DESCRIPTION
1890
*
1891
*       Testing mcapi_wait_any over mcapi_pktchan_recv_close_i - tx not
1892
*       opened, not connected
1893
*
1894
*           Node 1 – Create endpoint, open receive side, close receive
1895
*                    side, wait for completion
1896
*
1897
*************************************************************************/
1898
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_20)
1899
{
1900
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1901
    size_t              rx_len;
1902
    mcapi_boolean_t     finished;
1903
    mcapi_request_t     request;
1904
    mcapi_request_t     *req_ptr[1];
1905
 
1906
    /* Don't let any other test run while this test is running. */
1907
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1908
 
1909
    /* Open the receive side. */
1910
    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1911
                              mcapi_struct->local_endp,
1912
                              &mcapi_struct->request,
1913
                              &mcapi_struct->status);
1914
 
1915
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1916
    {
1917
        /* Close the receive side. */
1918
        mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1919
                                      &request, &mcapi_struct->status);
1920
 
1921
        if (mcapi_struct->status == MCAPI_SUCCESS)
1922
        {
1923
            req_ptr[0] = &request;
1924
 
1925
            /* Wait for the call to timeout. */
1926
            finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
1927
                                      &mcapi_struct->status);
1928
 
1929
            if ( (finished != 0) ||
1930
                 (mcapi_struct->status != MCAPI_SUCCESS) )
1931
            {
1932
                mcapi_struct->status = -1;
1933
            }
1934
        }
1935
    }
1936
 
1937
    /* Set the state of the test to completed. */
1938
    mcapi_struct->state = 0;
1939
 
1940
    /* Allow the next test to run. */
1941
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1942
 
1943
} /* MCAPI_FTS_Tx_2_35_20 */
1944
 
1945
/************************************************************************
1946
*
1947
*   FUNCTION
1948
*
1949
*       MCAPI_FTS_Tx_2_35_21
1950
*
1951
*   DESCRIPTION
1952
*
1953
*       Testing mcapi_wait_any over mcapi_pktchan_recv_close_i - tx opened,
1954
*       not connected
1955
*
1956
*           Node 0 - Create endpoint, open send side
1957
*
1958
*           Node 1 – Create endpoint, open receive side, wait for Node 0 to
1959
*                    open send side, wait for completion
1960
*
1961
*************************************************************************/
1962
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_21)
1963
{
1964
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1965
    size_t              rx_len;
1966
    mcapi_status_t      status;
1967
    mcapi_boolean_t     finished;
1968
    mcapi_request_t     request;
1969
    mcapi_request_t     *req_ptr[1];
1970
 
1971
    /* Don't let any other test run while this test is running. */
1972
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1973
 
1974
    /* Indicate that a remote endpoint should be created. */
1975
    mcapi_struct->status =
1976
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1977
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1978
 
1979
    if (mcapi_struct->status == MCAPI_SUCCESS)
1980
    {
1981
        /* Wait for the response. */
1982
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1983
 
1984
        /* If the endpoint was created. */
1985
        if (mcapi_struct->status == MCAPI_SUCCESS)
1986
        {
1987
            /* Indicate that the endpoint should be opened as a sender. */
1988
            mcapi_struct->status =
1989
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1990
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1991
 
1992
            /* Wait for the response. */
1993
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1994
 
1995
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1996
            {
1997
                /* Open the receive side. */
1998
                mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1999
                                          mcapi_struct->local_endp,
2000
                                          &mcapi_struct->request,
2001
                                          &mcapi_struct->status);
2002
 
2003
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2004
                {
2005
                    /* Close the receive side. */
2006
                    mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
2007
                                                  &request, &mcapi_struct->status);
2008
 
2009
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2010
                    {
2011
                        req_ptr[0] = &request;
2012
 
2013
                        /* Wait for the call to timeout. */
2014
                        finished = mcapi_wait_any(1, req_ptr, &rx_len,
2015
                                                  MCAPI_FTS_TIMEOUT,
2016
                                                  &mcapi_struct->status);
2017
 
2018
                        if ( (finished != 0) ||
2019
                             (mcapi_struct->status != MCAPI_SUCCESS) )
2020
                        {
2021
                            mcapi_struct->status = -1;
2022
                        }
2023
                    }
2024
                }
2025
 
2026
                /* Tell the other side to close the send side. */
2027
                status =
2028
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2029
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
2030
                                           1024, mcapi_struct->local_endp,
2031
                                           0, MCAPI_DEFAULT_PRIO);
2032
 
2033
                if (status == MCAPI_SUCCESS)
2034
                {
2035
                    /* Wait for the response. */
2036
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2037
                }
2038
            }
2039
 
2040
            /* Tell the other side to delete the endpoint. */
2041
            status =
2042
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2043
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2044
 
2045
            if (status == MCAPI_SUCCESS)
2046
            {
2047
                /* Wait for the response. */
2048
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2049
            }
2050
        }
2051
    }
2052
 
2053
    /* Set the state of the test to completed. */
2054
    mcapi_struct->state = 0;
2055
 
2056
    /* Allow the next test to run. */
2057
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2058
 
2059
} /* MCAPI_FTS_Tx_2_35_21 */
2060
 
2061
/************************************************************************
2062
*
2063
*   FUNCTION
2064
*
2065
*       MCAPI_FTS_Tx_2_35_22
2066
*
2067
*   DESCRIPTION
2068
*
2069
*       Testing mcapi_wait_any over mcapi_pktchan_recv_close_i - tx opened,
2070
*       connected
2071
*
2072
*           Node 0 - Create endpoint, open send side
2073
*
2074
*           Node 1 – Create endpoint, issue connection, open receive side,
2075
*                    wait for completion.
2076
*
2077
*************************************************************************/
2078
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_22)
2079
{
2080
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2081
    size_t              rx_len;
2082
    mcapi_status_t      status;
2083
    mcapi_boolean_t     finished;
2084
    mcapi_request_t     request;
2085
    mcapi_endpoint_t    tx_endp;
2086
    mcapi_request_t     *req_ptr[1];
2087
 
2088
    /* Don't let any other test run while this test is running. */
2089
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2090
 
2091
    /* Indicate that a remote endpoint should be created. */
2092
    mcapi_struct->status =
2093
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2094
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2095
 
2096
    if (mcapi_struct->status == MCAPI_SUCCESS)
2097
    {
2098
        /* Wait for the response. */
2099
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2100
 
2101
        /* If the endpoint was created. */
2102
        if (mcapi_struct->status == MCAPI_SUCCESS)
2103
        {
2104
            /* Indicate that the endpoint should be opened as a sender. */
2105
            mcapi_struct->status =
2106
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
2107
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2108
 
2109
            /* Wait for the response. */
2110
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2111
 
2112
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2113
            {
2114
                /* Get the send side endpoint. */
2115
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2116
 
2117
                if (mcapi_struct->status == MCAPI_SUCCESS)
2118
                {
2119
                    /* Connect the two endpoints. */
2120
                    mcapi_connect_pktchan_i(tx_endp, mcapi_struct->local_endp,
2121
                                            &mcapi_struct->request,
2122
                                            &mcapi_struct->status);
2123
 
2124
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2125
                    {
2126
                        /* Wait for the connection to open. */
2127
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
2128
                                   MCAPI_FTS_TIMEOUT);
2129
 
2130
                        if (mcapi_struct->status == MCAPI_SUCCESS)
2131
                        {
2132
                            /* Open the receive side. */
2133
                            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
2134
                                                      mcapi_struct->local_endp,
2135
                                                      &request, &mcapi_struct->status);
2136
 
2137
                            if (mcapi_struct->status == MCAPI_SUCCESS)
2138
                            {
2139
                                /* Wait for the receive side to open. */
2140
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
2141
                                           MCAPI_FTS_TIMEOUT);
2142
 
2143
                                if (mcapi_struct->status == MCAPI_SUCCESS)
2144
                                {
2145
                                    /* Close the receive side. */
2146
                                    mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
2147
                                                                  &request, &mcapi_struct->status);
2148
 
2149
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
2150
                                    {
2151
                                        req_ptr[0] = &request;
2152
 
2153
                                        /* Wait for the call to timeout. */
2154
                                        finished = mcapi_wait_any(1, req_ptr,
2155
                                                                  &rx_len,
2156
                                                                  MCAPI_FTS_TIMEOUT,
2157
                                                                  &mcapi_struct->status);
2158
 
2159
                                        if ( (finished != 0) ||
2160
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
2161
                                        {
2162
                                            mcapi_struct->status = -1;
2163
                                        }
2164
                                    }
2165
                                }
2166
                            }
2167
                        }
2168
                    }
2169
                }
2170
 
2171
                /* Tell the other side to close the send side. */
2172
                status =
2173
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2174
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
2175
                                           1024, mcapi_struct->local_endp,
2176
                                           0, MCAPI_DEFAULT_PRIO);
2177
 
2178
                if (status == MCAPI_SUCCESS)
2179
                {
2180
                    /* Wait for the response. */
2181
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2182
                }
2183
            }
2184
 
2185
            /* Tell the other side to delete the endpoint. */
2186
            status =
2187
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2188
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2189
 
2190
            if (status == MCAPI_SUCCESS)
2191
            {
2192
                /* Wait for the response. */
2193
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2194
            }
2195
        }
2196
    }
2197
 
2198
    /* Set the state of the test to completed. */
2199
    mcapi_struct->state = 0;
2200
 
2201
    /* Allow the next test to run. */
2202
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2203
 
2204
} /* MCAPI_FTS_Tx_2_35_22 */
2205
 
2206
/************************************************************************
2207
*
2208
*   FUNCTION
2209
*
2210
*       MCAPI_FTS_Tx_2_35_23
2211
*
2212
*   DESCRIPTION
2213
*
2214
*       Testing mcapi_wait_any over mcapi_pktchan_send_close_i - rx not
2215
*       opened, not connected
2216
*
2217
*           Node 1 – Create endpoint, open send side, close send
2218
*                    side, wait for completion.
2219
*
2220
*************************************************************************/
2221
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_23)
2222
{
2223
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2224
    size_t              rx_len;
2225
    mcapi_boolean_t     finished;
2226
    mcapi_request_t     request;
2227
    mcapi_request_t     *req_ptr[1];
2228
 
2229
    /* Don't let any other test run while this test is running. */
2230
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2231
 
2232
    /* Open the send side. */
2233
    mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
2234
                              mcapi_struct->local_endp,
2235
                              &mcapi_struct->request,
2236
                              &mcapi_struct->status);
2237
 
2238
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2239
    {
2240
        /* Close the send side. */
2241
        mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
2242
                                      &request, &mcapi_struct->status);
2243
 
2244
        if (mcapi_struct->status == MCAPI_SUCCESS)
2245
        {
2246
            req_ptr[0] = &request;
2247
 
2248
            /* Wait for the call to timeout. */
2249
            finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
2250
                                      &mcapi_struct->status);
2251
 
2252
            if ( (finished != 0) ||
2253
                 (mcapi_struct->status != MCAPI_SUCCESS) )
2254
            {
2255
                mcapi_struct->status = -1;
2256
            }
2257
        }
2258
    }
2259
 
2260
    /* Set the state of the test to completed. */
2261
    mcapi_struct->state = 0;
2262
 
2263
    /* Allow the next test to run. */
2264
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2265
 
2266
} /* MCAPI_FTS_Tx_2_35_23 */
2267
 
2268
/************************************************************************
2269
*
2270
*   FUNCTION
2271
*
2272
*       MCAPI_FTS_Tx_2_35_24
2273
*
2274
*   DESCRIPTION
2275
*
2276
*       Testing mcapi_wait_any over mcapi_pktchan_send_close_i - rx opened,
2277
*       not connected
2278
*
2279
*           Node 0 - Create endpoint, open receive side
2280
*
2281
*           Node 1 – Create endpoint, open send side, wait for Node 0 to
2282
*                    open receive side, wait for completion.
2283
*
2284
*************************************************************************/
2285
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_24)
2286
{
2287
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2288
    size_t              rx_len;
2289
    mcapi_status_t      status;
2290
    mcapi_boolean_t     finished;
2291
    mcapi_request_t     request;
2292
    mcapi_request_t     *req_ptr[1];
2293
 
2294
    /* Don't let any other test run while this test is running. */
2295
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2296
 
2297
    /* Indicate that a remote endpoint should be created. */
2298
    mcapi_struct->status =
2299
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2300
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2301
 
2302
    if (mcapi_struct->status == MCAPI_SUCCESS)
2303
    {
2304
        /* Wait for the response. */
2305
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2306
 
2307
        /* If the endpoint was created. */
2308
        if (mcapi_struct->status == MCAPI_SUCCESS)
2309
        {
2310
            /* Indicate that the endpoint should be opened as a receiver. */
2311
            mcapi_struct->status =
2312
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_PKT,
2313
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2314
 
2315
            /* Wait for the response. */
2316
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2317
 
2318
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2319
            {
2320
                /* Open the send side. */
2321
                mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
2322
                                          mcapi_struct->local_endp,
2323
                                          &mcapi_struct->request,
2324
                                          &mcapi_struct->status);
2325
 
2326
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2327
                {
2328
                    /* Close the send side. */
2329
                    mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
2330
                                                  &request, &mcapi_struct->status);
2331
 
2332
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2333
                    {
2334
                        req_ptr[0] = &request;
2335
 
2336
                        /* Wait for the call to timeout. */
2337
                        finished = mcapi_wait_any(1, req_ptr, &rx_len,
2338
                                                  MCAPI_FTS_TIMEOUT,
2339
                                                  &mcapi_struct->status);
2340
 
2341
                        if ( (finished != 0) ||
2342
                             (mcapi_struct->status != MCAPI_SUCCESS) )
2343
                        {
2344
                            mcapi_struct->status = -1;
2345
                        }
2346
                    }
2347
                }
2348
 
2349
                /* Tell the other side to close the receive side. */
2350
                status =
2351
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2352
                                           MCAPID_MGMT_CLOSE_RX_SIDE_PKT,
2353
                                           1024, mcapi_struct->local_endp,
2354
                                           0, MCAPI_DEFAULT_PRIO);
2355
 
2356
                if (status == MCAPI_SUCCESS)
2357
                {
2358
                    /* Wait for the response. */
2359
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2360
                }
2361
            }
2362
 
2363
            /* Tell the other side to delete the endpoint. */
2364
            status =
2365
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2366
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2367
 
2368
            if (status == MCAPI_SUCCESS)
2369
            {
2370
                /* Wait for the response. */
2371
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2372
            }
2373
        }
2374
    }
2375
 
2376
    /* Set the state of the test to completed. */
2377
    mcapi_struct->state = 0;
2378
 
2379
    /* Allow the next test to run. */
2380
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2381
 
2382
} /* MCAPI_FTS_Tx_2_35_24 */
2383
 
2384
/************************************************************************
2385
*
2386
*   FUNCTION
2387
*
2388
*       MCAPI_FTS_Tx_2_35_25
2389
*
2390
*   DESCRIPTION
2391
*
2392
*       Testing mcapi_wait_any over mcapi_pktchan_send_close_i - rx opened,
2393
*       connected
2394
*
2395
*           Node 0 - Create endpoint, open receive side
2396
*
2397
*           Node 1 – Create endpoint, issue connection, open send side,
2398
*                    wait for completion.
2399
*
2400
*************************************************************************/
2401
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_25)
2402
{
2403
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2404
    size_t              rx_len;
2405
    mcapi_status_t      status;
2406
    mcapi_boolean_t     finished;
2407
    mcapi_request_t     request;
2408
    mcapi_endpoint_t    rx_endp;
2409
    mcapi_request_t     *req_ptr[1];
2410
 
2411
    /* Don't let any other test run while this test is running. */
2412
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2413
 
2414
    /* Indicate that a remote endpoint should be created. */
2415
    mcapi_struct->status =
2416
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2417
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2418
 
2419
    if (mcapi_struct->status == MCAPI_SUCCESS)
2420
    {
2421
        /* Wait for the response. */
2422
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2423
 
2424
        /* If the endpoint was created. */
2425
        if (mcapi_struct->status == MCAPI_SUCCESS)
2426
        {
2427
            /* Indicate that the endpoint should be opened as a receiver. */
2428
            mcapi_struct->status =
2429
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_PKT,
2430
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2431
 
2432
            /* Wait for the response. */
2433
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2434
 
2435
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2436
            {
2437
                /* Get the receive side endpoint. */
2438
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2439
 
2440
                if (mcapi_struct->status == MCAPI_SUCCESS)
2441
                {
2442
                    /* Connect the two endpoints. */
2443
                    mcapi_connect_pktchan_i(mcapi_struct->local_endp, rx_endp,
2444
                                            &mcapi_struct->request,
2445
                                            &mcapi_struct->status);
2446
 
2447
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2448
                    {
2449
                        /* Wait for the connection to open. */
2450
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
2451
                                   MCAPI_FTS_TIMEOUT);
2452
 
2453
                        if (mcapi_struct->status == MCAPI_SUCCESS)
2454
                        {
2455
                            /* Open the send side. */
2456
                            mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
2457
                                                      mcapi_struct->local_endp,
2458
                                                      &request, &mcapi_struct->status);
2459
 
2460
                            if (mcapi_struct->status == MCAPI_SUCCESS)
2461
                            {
2462
                                /* Wait for the send side to open. */
2463
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
2464
                                           MCAPI_FTS_TIMEOUT);
2465
 
2466
                                if (mcapi_struct->status == MCAPI_SUCCESS)
2467
                                {
2468
                                    /* Close the send side. */
2469
                                    mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
2470
                                                                  &request, &mcapi_struct->status);
2471
 
2472
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
2473
                                    {
2474
                                        req_ptr[0] = &request;
2475
 
2476
                                        /* Wait for the call to timeout. */
2477
                                        finished = mcapi_wait_any(1, req_ptr,
2478
                                                                  &rx_len,
2479
                                                                  MCAPI_FTS_TIMEOUT,
2480
                                                                  &mcapi_struct->status);
2481
 
2482
                                        if ( (finished != 0) ||
2483
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
2484
                                        {
2485
                                            mcapi_struct->status = -1;
2486
                                        }
2487
                                    }
2488
                                }
2489
                            }
2490
                        }
2491
                    }
2492
                }
2493
 
2494
                /* Tell the other side to close the receive side. */
2495
                status =
2496
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2497
                                           MCAPID_MGMT_CLOSE_RX_SIDE_PKT,
2498
                                           1024, mcapi_struct->local_endp,
2499
                                           0, MCAPI_DEFAULT_PRIO);
2500
 
2501
                if (status == MCAPI_SUCCESS)
2502
                {
2503
                    /* Wait for the response. */
2504
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2505
                }
2506
            }
2507
 
2508
            /* Tell the other side to delete the endpoint. */
2509
            status =
2510
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2511
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2512
 
2513
            if (status == MCAPI_SUCCESS)
2514
            {
2515
                /* Wait for the response. */
2516
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2517
            }
2518
        }
2519
    }
2520
 
2521
    /* Set the state of the test to completed. */
2522
    mcapi_struct->state = 0;
2523
 
2524
    /* Allow the next test to run. */
2525
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2526
 
2527
} /* MCAPI_FTS_Tx_2_35_25 */
2528
 
2529
/************************************************************************
2530
*
2531
*   FUNCTION
2532
*
2533
*       MCAPI_FTS_Tx_2_35_26
2534
*
2535
*   DESCRIPTION
2536
*
2537
*       Testing mcapi_wait_any over mcapi_connect_sclchan_i - completed
2538
*
2539
*           Node 0 – Create an endpoint
2540
*
2541
*           Node 1 – Create an endpoint, get the endpoint on Node 0, issue
2542
*                    connection, wait for completion
2543
*
2544
*************************************************************************/
2545
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_26)
2546
{
2547
    MCAPID_STRUCT           *mcapi_struct = (MCAPID_STRUCT*)argv;
2548
    size_t                  rx_len;
2549
    mcapi_status_t          status;
2550
    mcapi_endpoint_t        tx_endp, rx_endp;
2551
    mcapi_boolean_t         finished;
2552
    mcapi_request_t         *req_ptr[1];
2553
 
2554
    /* Don't let any other test run while this test is running. */
2555
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2556
 
2557
    /* An extra endpoint is required for the test. */
2558
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
2559
 
2560
    if (mcapi_struct->status == MCAPI_SUCCESS)
2561
    {
2562
        /* Indicate that a remote endpoint should be created. */
2563
        mcapi_struct->status =
2564
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2565
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2566
 
2567
        if (mcapi_struct->status == MCAPI_SUCCESS)
2568
        {
2569
            /* Wait for a response. */
2570
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2571
 
2572
            /* If the endpoint was created. */
2573
            if (mcapi_struct->status == MCAPI_SUCCESS)
2574
            {
2575
                /* Get the foreign endpoint. */
2576
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2577
 
2578
                if (mcapi_struct->status == MCAPI_SUCCESS)
2579
                {
2580
                    /* Connect the two endpoints. */
2581
                    mcapi_connect_sclchan_i(tx_endp, rx_endp,
2582
                                            &mcapi_struct->request,
2583
                                            &mcapi_struct->status);
2584
 
2585
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2586
                    {
2587
                        req_ptr[0] = &mcapi_struct->request;
2588
 
2589
                        /* Wait for the call to timeout. */
2590
                        finished = mcapi_wait_any(1, req_ptr, &rx_len,
2591
                                                  MCAPI_FTS_TIMEOUT,
2592
                                                  &mcapi_struct->status);
2593
 
2594
                        if ( (finished != 0) ||
2595
                             (mcapi_struct->status != MCAPI_SUCCESS) )
2596
                        {
2597
                            mcapi_struct->status = -1;
2598
                        }
2599
                    }
2600
                }
2601
 
2602
                /* Tell the other side to delete the endpoint. */
2603
                status =
2604
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2605
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2606
 
2607
                if (status == MCAPI_SUCCESS)
2608
                {
2609
                    /* Wait for the response. */
2610
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2611
                }
2612
            }
2613
        }
2614
 
2615
        /* Delete the extra endpoint. */
2616
        mcapi_delete_endpoint(rx_endp, &status);
2617
    }
2618
 
2619
    /* Set the state of the test to completed. */
2620
    mcapi_struct->state = 0;
2621
 
2622
    /* Allow the next test to run. */
2623
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2624
 
2625
} /* MCAPI_FTS_Tx_2_35_26 */
2626
 
2627
/************************************************************************
2628
*
2629
*   FUNCTION
2630
*
2631
*       MCAPI_FTS_Tx_2_35_27
2632
*
2633
*   DESCRIPTION
2634
*
2635
*       Testing mcapi_wait_any over mcapi_open_sclchan_recv_i - timed out
2636
*
2637
*           Node 1 – Create endpoint, open receive side, wait for
2638
*                    open to time out
2639
*
2640
*************************************************************************/
2641
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_27)
2642
{
2643
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2644
    size_t              rx_len;
2645
    mcapi_status_t      status;
2646
    mcapi_boolean_t     finished;
2647
    mcapi_request_t     *req_ptr[1];
2648
 
2649
    /* Don't let any other test run while this test is running. */
2650
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2651
 
2652
    /* Open the receive side. */
2653
    mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
2654
                              mcapi_struct->local_endp,
2655
                              &mcapi_struct->request,
2656
                              &mcapi_struct->status);
2657
 
2658
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2659
    {
2660
        req_ptr[0] = &mcapi_struct->request;
2661
 
2662
        /* Wait for the call to timeout. */
2663
        finished = mcapi_wait_any(1, req_ptr, &rx_len, 250,
2664
                                  &mcapi_struct->status);
2665
 
2666
        if ( (mcapi_struct->status == MCAPI_TIMEOUT) &&
2667
             (finished == 0) )
2668
        {
2669
            mcapi_struct->status = MCAPI_SUCCESS;
2670
        }
2671
 
2672
        else
2673
        {
2674
            mcapi_struct->status = -1;
2675
        }
2676
 
2677
        mcapi_cancel(&mcapi_struct->request, &status);
2678
    }
2679
 
2680
    /* Set the state of the test to completed. */
2681
    mcapi_struct->state = 0;
2682
 
2683
    /* Allow the next test to run. */
2684
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2685
 
2686
} /* MCAPI_FTS_Tx_2_35_27 */
2687
 
2688
/************************************************************************
2689
*
2690
*   FUNCTION
2691
*
2692
*       MCAPI_FTS_Tx_2_35_28
2693
*
2694
*   DESCRIPTION
2695
*
2696
*       Testing mcapi_wait_any over mcapi_open_sclchan_recv_i - complete
2697
*
2698
*           Node 0 - Create endpoint, open send side.
2699
*
2700
*           Node 1 – Create endpoint, connect, open receive side, wait for
2701
*                    completion.
2702
*
2703
*************************************************************************/
2704
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_28)
2705
{
2706
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2707
    size_t              rx_len;
2708
    mcapi_status_t      status;
2709
    mcapi_boolean_t     finished;
2710
    mcapi_request_t     request;
2711
    mcapi_endpoint_t    tx_endp;
2712
    mcapi_request_t     *req_ptr[1];
2713
 
2714
    /* Don't let any other test run while this test is running. */
2715
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2716
 
2717
    /* Indicate that a remote endpoint should be created. */
2718
    mcapi_struct->status =
2719
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2720
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2721
 
2722
    if (mcapi_struct->status == MCAPI_SUCCESS)
2723
    {
2724
        /* Wait for the response. */
2725
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2726
 
2727
        /* If the endpoint was created. */
2728
        if (mcapi_struct->status == MCAPI_SUCCESS)
2729
        {
2730
            /* Indicate that the endpoint should be opened as a sender. */
2731
            mcapi_struct->status =
2732
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
2733
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2734
 
2735
            /* Wait for the response. */
2736
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2737
 
2738
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2739
            {
2740
                /* Get the foreign endpoint. */
2741
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2742
 
2743
                if (mcapi_struct->status == MCAPI_SUCCESS)
2744
                {
2745
                    /* Connect two endpoints. */
2746
                    mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
2747
                                            &mcapi_struct->request,
2748
                                            &mcapi_struct->status);
2749
 
2750
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2751
                    {
2752
                        /* Open the receive side. */
2753
                        mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
2754
                                                  mcapi_struct->local_endp,
2755
                                                  &request, &mcapi_struct->status);
2756
 
2757
                        req_ptr[0] = &request;
2758
 
2759
                        /* Wait for the call to timeout. */
2760
                        finished = mcapi_wait_any(1, req_ptr, &rx_len,
2761
                                                  MCAPI_FTS_TIMEOUT,
2762
                                                  &mcapi_struct->status);
2763
 
2764
                        if ( (finished != 0) ||
2765
                             (mcapi_struct->status != MCAPI_SUCCESS) )
2766
                        {
2767
                            mcapi_struct->status = -1;
2768
                        }
2769
 
2770
                        /* Close the receive side. */
2771
                        mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
2772
                                                   &request, &status);
2773
                    }
2774
                }
2775
 
2776
                /* Tell the other side to close the send side. */
2777
                status =
2778
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2779
                                           MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
2780
                                           1024, mcapi_struct->local_endp,
2781
                                           0, MCAPI_DEFAULT_PRIO);
2782
 
2783
                if (status == MCAPI_SUCCESS)
2784
                {
2785
                    /* Wait for the response. */
2786
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2787
                }
2788
            }
2789
 
2790
            /* Tell the other side to delete the endpoint. */
2791
            status =
2792
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2793
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2794
 
2795
            if (status == MCAPI_SUCCESS)
2796
            {
2797
                /* Wait for the response. */
2798
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2799
            }
2800
        }
2801
    }
2802
 
2803
    /* Set the state of the test to completed. */
2804
    mcapi_struct->state = 0;
2805
 
2806
    /* Allow the next test to run. */
2807
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2808
 
2809
} /* MCAPI_FTS_Tx_2_35_28 */
2810
 
2811
#ifdef LCL_MGMT_UNBROKEN
2812
/************************************************************************
2813
*
2814
*   FUNCTION
2815
*
2816
*       MCAPI_FTS_Tx_2_35_29
2817
*
2818
*   DESCRIPTION
2819
*
2820
*       Testing mcapi_wait_any over mcapi_open_sclchan_recv_i - canceled
2821
*
2822
*           Node 1 – Create endpoint, open receive side, cancel, wait for
2823
*                    completion.
2824
*
2825
*************************************************************************/
2826
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_29)
2827
{
2828
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
2829
    size_t              rx_len;
2830
    mcapi_boolean_t     finished;
2831
    mcapi_request_t     *req_ptr[1];
2832
 
2833
    /* Don't let any other test run while this test is running. */
2834
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2835
 
2836
    /* Set up the structure for getting the local management server. */
2837
    svc_struct.type = MCAPI_MSG_TX_TYPE;
2838
    svc_struct.local_port = MCAPI_PORT_ANY;
2839
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
2840
    svc_struct.service = "lcl_mgmt";
2841
    svc_struct.thread_entry = MCAPI_NULL;
2842
 
2843
    /* Create the client service that will cancel the call. */
2844
    MCAPID_Create_Service(&svc_struct);
2845
 
2846
    /* Open the receive side. */
2847
    mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
2848
                              mcapi_struct->local_endp,
2849
                              &svc_struct.request,
2850
                              &mcapi_struct->status);
2851
 
2852
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2853
    {
2854
        /* Cause the call to be canceled in 1 second. */
2855
        mcapi_struct->status =
2856
            MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
2857
                                   svc_struct.local_endp, 1000, MCAPI_DEFAULT_PRIO);
2858
 
2859
        if (mcapi_struct->status == MCAPI_SUCCESS)
2860
        {
2861
            req_ptr[0] = &svc_struct.request;
2862
 
2863
            /* Wait for the call to timeout. */
2864
            finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
2865
                                      &mcapi_struct->status);
2866
 
2867
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
2868
                 (finished == 0) )
2869
            {
2870
                mcapi_struct->status = MCAPI_SUCCESS;
2871
            }
2872
 
2873
            else
2874
            {
2875
                mcapi_struct->status = -1;
2876
            }
2877
        }
2878
    }
2879
 
2880
    /* Destroy the client service. */
2881
    MCAPID_Destroy_Service(&svc_struct, 1);
2882
 
2883
    /* Set the state of the test to completed. */
2884
    mcapi_struct->state = 0;
2885
 
2886
    /* Allow the next test to run. */
2887
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2888
 
2889
} /* MCAPI_FTS_Tx_2_35_29 */
2890
#endif
2891
 
2892
/************************************************************************
2893
*
2894
*   FUNCTION
2895
*
2896
*       MCAPI_FTS_Tx_2_35_30
2897
*
2898
*   DESCRIPTION
2899
*
2900
*       Testing mcapi_wait_any over mcapi_open_sclchan_send_i - timed out
2901
*
2902
*           Node 1 – Create endpoint, open send side, wait for
2903
*                    open to time out
2904
*
2905
*************************************************************************/
2906
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_30)
2907
{
2908
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2909
    size_t              rx_len;
2910
    mcapi_status_t      status;
2911
    mcapi_boolean_t     finished;
2912
    mcapi_request_t     *req_ptr[1];
2913
 
2914
    /* Don't let any other test run while this test is running. */
2915
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2916
 
2917
    /* Open the send side. */
2918
    mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
2919
                              mcapi_struct->local_endp,
2920
                              &mcapi_struct->request,
2921
                              &mcapi_struct->status);
2922
 
2923
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2924
    {
2925
        req_ptr[0] = &mcapi_struct->request;
2926
 
2927
        /* Wait for the call to timeout. */
2928
        finished = mcapi_wait_any(1, req_ptr, &rx_len, 250,
2929
                                  &mcapi_struct->status);
2930
 
2931
        if ( (mcapi_struct->status == MCAPI_TIMEOUT) &&
2932
             (finished == 0) )
2933
        {
2934
            mcapi_struct->status = MCAPI_SUCCESS;
2935
        }
2936
 
2937
        else
2938
        {
2939
            mcapi_struct->status = -1;
2940
        }
2941
 
2942
        mcapi_cancel(&mcapi_struct->request, &status);
2943
    }
2944
 
2945
    /* Set the state of the test to completed. */
2946
    mcapi_struct->state = 0;
2947
 
2948
    /* Allow the next test to run. */
2949
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2950
 
2951
} /* MCAPI_FTS_Tx_2_35_30 */
2952
 
2953
/************************************************************************
2954
*
2955
*   FUNCTION
2956
*
2957
*       MCAPI_FTS_Tx_2_35_31
2958
*
2959
*   DESCRIPTION
2960
*
2961
*       Testing mcapi_wait_any over mcapi_open_sclchan_send_i - complete
2962
*
2963
*           Node 0 - Create endpoint, open receive side.
2964
*
2965
*           Node 1 – Create endpoint, connect, open send side, wait for
2966
*                    completion.
2967
*
2968
*************************************************************************/
2969
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_31)
2970
{
2971
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2972
    size_t              rx_len;
2973
    mcapi_status_t      status;
2974
    mcapi_boolean_t     finished;
2975
    mcapi_request_t     request;
2976
    mcapi_endpoint_t    rx_endp;
2977
    mcapi_request_t     *req_ptr[1];
2978
 
2979
    /* Don't let any other test run while this test is running. */
2980
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2981
 
2982
    /* Indicate that a remote endpoint should be created. */
2983
    mcapi_struct->status =
2984
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2985
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2986
 
2987
    if (mcapi_struct->status == MCAPI_SUCCESS)
2988
    {
2989
        /* Wait for the response. */
2990
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2991
 
2992
        /* If the endpoint was created. */
2993
        if (mcapi_struct->status == MCAPI_SUCCESS)
2994
        {
2995
            /* Indicate that the endpoint should be opened as a receiver. */
2996
            mcapi_struct->status =
2997
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
2998
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2999
 
3000
            /* Wait for the response. */
3001
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3002
 
3003
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3004
            {
3005
                /* Get the foreign endpoint. */
3006
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
3007
 
3008
                if (mcapi_struct->status == MCAPI_SUCCESS)
3009
                {
3010
                    /* Connect two endpoints. */
3011
                    mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
3012
                                            &mcapi_struct->request,
3013
                                            &mcapi_struct->status);
3014
 
3015
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3016
                    {
3017
                        /* Open the send side. */
3018
                        mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3019
                                                  mcapi_struct->local_endp,
3020
                                                  &request, &mcapi_struct->status);
3021
 
3022
                        req_ptr[0] = &request;
3023
 
3024
                        /* Wait for the call to timeout. */
3025
                        finished = mcapi_wait_any(1, req_ptr, &rx_len,
3026
                                                  MCAPI_FTS_TIMEOUT,
3027
                                                  &mcapi_struct->status);
3028
 
3029
                        if ( (finished != 0) ||
3030
                             (mcapi_struct->status != MCAPI_SUCCESS) )
3031
                        {
3032
                            mcapi_struct->status = -1;
3033
                        }
3034
 
3035
                        /* Close the send side. */
3036
                        mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
3037
                                                   &request, &status);
3038
                    }
3039
                }
3040
 
3041
                /* Tell the other side to close the receive side. */
3042
                status =
3043
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3044
                                           MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
3045
                                           1024, mcapi_struct->local_endp,
3046
                                           0, MCAPI_DEFAULT_PRIO);
3047
 
3048
                if (status == MCAPI_SUCCESS)
3049
                {
3050
                    /* Wait for the response. */
3051
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3052
                }
3053
            }
3054
 
3055
            /* Tell the other side to delete the endpoint. */
3056
            status =
3057
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3058
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3059
 
3060
            if (status == MCAPI_SUCCESS)
3061
            {
3062
                /* Wait for the response. */
3063
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3064
            }
3065
        }
3066
    }
3067
 
3068
    /* Set the state of the test to completed. */
3069
    mcapi_struct->state = 0;
3070
 
3071
    /* Allow the next test to run. */
3072
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3073
 
3074
} /* MCAPI_FTS_Tx_2_35_31 */
3075
 
3076
#ifdef LCL_MGMT_UNBROKEN
3077
/************************************************************************
3078
*
3079
*   FUNCTION
3080
*
3081
*       MCAPI_FTS_Tx_2_35_32
3082
*
3083
*   DESCRIPTION
3084
*
3085
*       Testing mcapi_wait_any over mcapi_open_sclchan_send_i - canceled
3086
*
3087
*           Node 1 – Create endpoint, open send side, cancel, wait for
3088
*                    completion.
3089
*
3090
*************************************************************************/
3091
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_32)
3092
{
3093
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
3094
    size_t              rx_len;
3095
    mcapi_boolean_t     finished;
3096
    mcapi_request_t     *req_ptr[1];
3097
 
3098
    /* Don't let any other test run while this test is running. */
3099
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3100
 
3101
    /* Set up the structure for getting the local management server. */
3102
    svc_struct.type = MCAPI_MSG_TX_TYPE;
3103
    svc_struct.local_port = MCAPI_PORT_ANY;
3104
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
3105
    svc_struct.service = "lcl_mgmt";
3106
    svc_struct.thread_entry = MCAPI_NULL;
3107
 
3108
    /* Create the client service that will cancel the call. */
3109
    MCAPID_Create_Service(&svc_struct);
3110
 
3111
    /* Open the send side. */
3112
    mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3113
                              mcapi_struct->local_endp,
3114
                              &svc_struct.request,
3115
                              &mcapi_struct->status);
3116
 
3117
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3118
    {
3119
        /* Cause the call to be canceled in 1 second. */
3120
        mcapi_struct->status =
3121
            MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
3122
                                   svc_struct.local_endp, 1000, MCAPI_DEFAULT_PRIO);
3123
 
3124
        if (mcapi_struct->status == MCAPI_SUCCESS)
3125
        {
3126
            req_ptr[0] = &svc_struct.request;
3127
 
3128
            /* Wait for the call to timeout. */
3129
            finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
3130
                                      &mcapi_struct->status);
3131
 
3132
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
3133
                 (finished == 0) )
3134
            {
3135
                mcapi_struct->status = MCAPI_SUCCESS;
3136
            }
3137
 
3138
            else
3139
            {
3140
                mcapi_struct->status = -1;
3141
            }
3142
        }
3143
    }
3144
 
3145
    /* Destroy the client service. */
3146
    MCAPID_Destroy_Service(&svc_struct, 1);
3147
 
3148
    /* Set the state of the test to completed. */
3149
    mcapi_struct->state = 0;
3150
 
3151
    /* Allow the next test to run. */
3152
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3153
 
3154
} /* MCAPI_FTS_Tx_2_35_32 */
3155
#endif
3156
 
3157
/************************************************************************
3158
*
3159
*   FUNCTION
3160
*
3161
*       MCAPI_FTS_Tx_2_35_33
3162
*
3163
*   DESCRIPTION
3164
*
3165
*       Testing mcapi_wait_any over mcapi_sclchan_recv_close_i - tx not
3166
*       opened, not connected
3167
*
3168
*           Node 1 – Create endpoint, open receive side, close receive
3169
*                    side, wait for completion
3170
*
3171
*************************************************************************/
3172
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_33)
3173
{
3174
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3175
    size_t              rx_len;
3176
    mcapi_boolean_t     finished;
3177
    mcapi_request_t     request;
3178
    mcapi_request_t     *req_ptr[1];
3179
 
3180
    /* Don't let any other test run while this test is running. */
3181
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3182
 
3183
    /* Open the receive side. */
3184
    mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
3185
                              mcapi_struct->local_endp,
3186
                              &mcapi_struct->request,
3187
                              &mcapi_struct->status);
3188
 
3189
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3190
    {
3191
        /* Close the receive side. */
3192
        mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
3193
                                   &request, &mcapi_struct->status);
3194
 
3195
        if (mcapi_struct->status == MCAPI_SUCCESS)
3196
        {
3197
            req_ptr[0] = &request;
3198
 
3199
            /* Wait for the call to timeout. */
3200
            finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
3201
                                      &mcapi_struct->status);
3202
 
3203
            if ( (finished != 0) ||
3204
                 (mcapi_struct->status != MCAPI_SUCCESS) )
3205
            {
3206
                mcapi_struct->status = -1;
3207
            }
3208
        }
3209
    }
3210
 
3211
    /* Set the state of the test to completed. */
3212
    mcapi_struct->state = 0;
3213
 
3214
    /* Allow the next test to run. */
3215
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3216
 
3217
} /* MCAPI_FTS_Tx_2_35_33 */
3218
 
3219
/************************************************************************
3220
*
3221
*   FUNCTION
3222
*
3223
*       MCAPI_FTS_Tx_2_35_34
3224
*
3225
*   DESCRIPTION
3226
*
3227
*       Testing mcapi_wait_any over mcapi_sclchan_recv_close_i - tx opened,
3228
*       not connected
3229
*
3230
*           Node 0 - Create endpoint, open send side
3231
*
3232
*           Node 1 – Create endpoint, open receive side, wait for Node 0 to
3233
*                    open send side, wait for completion
3234
*
3235
*************************************************************************/
3236
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_34)
3237
{
3238
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3239
    size_t              rx_len;
3240
    mcapi_status_t      status;
3241
    mcapi_boolean_t     finished;
3242
    mcapi_request_t     request;
3243
    mcapi_request_t     *req_ptr[1];
3244
 
3245
    /* Don't let any other test run while this test is running. */
3246
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3247
 
3248
    /* Indicate that a remote endpoint should be created. */
3249
    mcapi_struct->status =
3250
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3251
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3252
 
3253
    if (mcapi_struct->status == MCAPI_SUCCESS)
3254
    {
3255
        /* Wait for the response. */
3256
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3257
 
3258
        /* If the endpoint was created. */
3259
        if (mcapi_struct->status == MCAPI_SUCCESS)
3260
        {
3261
            /* Indicate that the endpoint should be opened as a sender. */
3262
            mcapi_struct->status =
3263
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
3264
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3265
 
3266
            /* Wait for the response. */
3267
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3268
 
3269
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3270
            {
3271
                /* Open the receive side. */
3272
                mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
3273
                                          mcapi_struct->local_endp,
3274
                                          &mcapi_struct->request,
3275
                                          &mcapi_struct->status);
3276
 
3277
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3278
                {
3279
                    /* Close the receive side. */
3280
                    mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
3281
                                               &request, &mcapi_struct->status);
3282
 
3283
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3284
                    {
3285
                        req_ptr[0] = &request;
3286
 
3287
                        /* Wait for the call to timeout. */
3288
                        finished = mcapi_wait_any(1, req_ptr, &rx_len,
3289
                                                  MCAPI_FTS_TIMEOUT,
3290
                                                  &mcapi_struct->status);
3291
 
3292
                        if ( (finished != 0) ||
3293
                             (mcapi_struct->status != MCAPI_SUCCESS) )
3294
                        {
3295
                            mcapi_struct->status = -1;
3296
                        }
3297
                    }
3298
                }
3299
 
3300
                /* Tell the other side to close the send side. */
3301
                status =
3302
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3303
                                           MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
3304
                                           1024, mcapi_struct->local_endp,
3305
                                           0, MCAPI_DEFAULT_PRIO);
3306
 
3307
                if (status == MCAPI_SUCCESS)
3308
                {
3309
                    /* Wait for the response. */
3310
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3311
                }
3312
            }
3313
 
3314
            /* Tell the other side to delete the endpoint. */
3315
            status =
3316
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3317
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3318
 
3319
            if (status == MCAPI_SUCCESS)
3320
            {
3321
                /* Wait for the response. */
3322
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3323
            }
3324
        }
3325
    }
3326
 
3327
    /* Set the state of the test to completed. */
3328
    mcapi_struct->state = 0;
3329
 
3330
    /* Allow the next test to run. */
3331
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3332
 
3333
} /* MCAPI_FTS_Tx_2_35_34 */
3334
 
3335
/************************************************************************
3336
*
3337
*   FUNCTION
3338
*
3339
*       MCAPI_FTS_Tx_2_35_35
3340
*
3341
*   DESCRIPTION
3342
*
3343
*       Testing mcapi_wait_any over mcapi_pktchan_recv_close_i - tx opened,
3344
*       connected
3345
*
3346
*           Node 0 - Create endpoint, open send side
3347
*
3348
*           Node 1 – Create endpoint, issue connection, open receive side,
3349
*                    wait for completion.
3350
*
3351
*************************************************************************/
3352
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_35)
3353
{
3354
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3355
    size_t              rx_len;
3356
    mcapi_status_t      status;
3357
    mcapi_boolean_t     finished;
3358
    mcapi_request_t     request;
3359
    mcapi_endpoint_t    tx_endp;
3360
    mcapi_request_t     *req_ptr[1];
3361
 
3362
    /* Don't let any other test run while this test is running. */
3363
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3364
 
3365
    /* Indicate that a remote endpoint should be created. */
3366
    mcapi_struct->status =
3367
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3368
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3369
 
3370
    if (mcapi_struct->status == MCAPI_SUCCESS)
3371
    {
3372
        /* Wait for the response. */
3373
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3374
 
3375
        /* If the endpoint was created. */
3376
        if (mcapi_struct->status == MCAPI_SUCCESS)
3377
        {
3378
            /* Indicate that the endpoint should be opened as a sender. */
3379
            mcapi_struct->status =
3380
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
3381
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3382
 
3383
            /* Wait for the response. */
3384
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3385
 
3386
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3387
            {
3388
                /* Get the send side endpoint. */
3389
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
3390
 
3391
                if (mcapi_struct->status == MCAPI_SUCCESS)
3392
                {
3393
                    /* Connect the two endpoints. */
3394
                    mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
3395
                                            &mcapi_struct->request,
3396
                                            &mcapi_struct->status);
3397
 
3398
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3399
                    {
3400
                        /* Wait for the connection to open. */
3401
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
3402
                                   MCAPI_FTS_TIMEOUT);
3403
 
3404
                        if (mcapi_struct->status == MCAPI_SUCCESS)
3405
                        {
3406
                            /* Open the receive side. */
3407
                            mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
3408
                                                      mcapi_struct->local_endp,
3409
                                                      &request, &mcapi_struct->status);
3410
 
3411
                            if (mcapi_struct->status == MCAPI_SUCCESS)
3412
                            {
3413
                                /* Wait for the receive side to open. */
3414
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
3415
                                           MCAPI_FTS_TIMEOUT);
3416
 
3417
                                if (mcapi_struct->status == MCAPI_SUCCESS)
3418
                                {
3419
                                    /* Close the receive side. */
3420
                                    mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
3421
                                                               &request, &mcapi_struct->status);
3422
 
3423
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
3424
                                    {
3425
                                        req_ptr[0] = &request;
3426
 
3427
                                        /* Wait for the call to timeout. */
3428
                                        finished = mcapi_wait_any(1, req_ptr,
3429
                                                                  &rx_len,
3430
                                                                  MCAPI_FTS_TIMEOUT,
3431
                                                                  &mcapi_struct->status);
3432
 
3433
                                        if ( (finished != 0) ||
3434
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
3435
                                        {
3436
                                            mcapi_struct->status = -1;
3437
                                        }
3438
                                    }
3439
                                }
3440
                            }
3441
                        }
3442
                    }
3443
                }
3444
 
3445
                /* Tell the other side to close the send side. */
3446
                status =
3447
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3448
                                           MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
3449
                                           1024, mcapi_struct->local_endp,
3450
                                           0, MCAPI_DEFAULT_PRIO);
3451
 
3452
                if (status == MCAPI_SUCCESS)
3453
                {
3454
                    /* Wait for the response. */
3455
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3456
                }
3457
            }
3458
 
3459
            /* Tell the other side to delete the endpoint. */
3460
            status =
3461
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3462
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3463
 
3464
            if (status == MCAPI_SUCCESS)
3465
            {
3466
                /* Wait for the response. */
3467
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3468
            }
3469
        }
3470
    }
3471
 
3472
    /* Set the state of the test to completed. */
3473
    mcapi_struct->state = 0;
3474
 
3475
    /* Allow the next test to run. */
3476
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3477
 
3478
} /* MCAPI_FTS_Tx_2_35_35 */
3479
 
3480
/************************************************************************
3481
*
3482
*   FUNCTION
3483
*
3484
*       MCAPI_FTS_Tx_2_35_36
3485
*
3486
*   DESCRIPTION
3487
*
3488
*       Testing mcapi_wait_any over mcapi_sclchan_send_close_i - rx not
3489
*       opened, not connected
3490
*
3491
*           Node 1 – Create endpoint, open send side, close send
3492
*                    side, wait for completion.
3493
*
3494
*************************************************************************/
3495
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_36)
3496
{
3497
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3498
    size_t              rx_len;
3499
    mcapi_boolean_t     finished;
3500
    mcapi_request_t     request;
3501
    mcapi_request_t     *req_ptr[1];
3502
 
3503
    /* Don't let any other test run while this test is running. */
3504
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3505
 
3506
    /* Open the send side. */
3507
    mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3508
                              mcapi_struct->local_endp,
3509
                              &mcapi_struct->request,
3510
                              &mcapi_struct->status);
3511
 
3512
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3513
    {
3514
        /* Close the send side. */
3515
        mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
3516
                                   &request, &mcapi_struct->status);
3517
 
3518
        if (mcapi_struct->status == MCAPI_SUCCESS)
3519
        {
3520
            req_ptr[0] = &request;
3521
 
3522
            /* Wait for the call to timeout. */
3523
            finished = mcapi_wait_any(1, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
3524
                                      &mcapi_struct->status);
3525
 
3526
            if ( (finished != 0) ||
3527
                 (mcapi_struct->status != MCAPI_SUCCESS) )
3528
            {
3529
                mcapi_struct->status = -1;
3530
            }
3531
        }
3532
    }
3533
 
3534
    /* Set the state of the test to completed. */
3535
    mcapi_struct->state = 0;
3536
 
3537
    /* Allow the next test to run. */
3538
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3539
 
3540
} /* MCAPI_FTS_Tx_2_35_36 */
3541
 
3542
/************************************************************************
3543
*
3544
*   FUNCTION
3545
*
3546
*       MCAPI_FTS_Tx_2_35_37
3547
*
3548
*   DESCRIPTION
3549
*
3550
*       Testing mcapi_wait_any over mcapi_sclchan_send_close_i - rx opened,
3551
*       not connected
3552
*
3553
*           Node 0 - Create endpoint, open receive side
3554
*
3555
*           Node 1 – Create endpoint, open send side, wait for Node 0 to
3556
*                    open receive side, wait for completion.
3557
*
3558
*************************************************************************/
3559
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_37)
3560
{
3561
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3562
    size_t              rx_len;
3563
    mcapi_status_t      status;
3564
    mcapi_boolean_t     finished;
3565
    mcapi_request_t     request;
3566
    mcapi_request_t     *req_ptr[1];
3567
 
3568
    /* Don't let any other test run while this test is running. */
3569
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3570
 
3571
    /* Indicate that a remote endpoint should be created. */
3572
    mcapi_struct->status =
3573
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3574
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3575
 
3576
    if (mcapi_struct->status == MCAPI_SUCCESS)
3577
    {
3578
        /* Wait for the response. */
3579
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3580
 
3581
        /* If the endpoint was created. */
3582
        if (mcapi_struct->status == MCAPI_SUCCESS)
3583
        {
3584
            /* Indicate that the endpoint should be opened as a receiver. */
3585
            mcapi_struct->status =
3586
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
3587
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3588
 
3589
            /* Wait for the response. */
3590
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3591
 
3592
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3593
            {
3594
                /* Open the send side. */
3595
                mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3596
                                          mcapi_struct->local_endp,
3597
                                          &mcapi_struct->request,
3598
                                          &mcapi_struct->status);
3599
 
3600
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3601
                {
3602
                    /* Close the send side. */
3603
                    mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
3604
                                               &request, &mcapi_struct->status);
3605
 
3606
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3607
                    {
3608
                        req_ptr[0] = &request;
3609
 
3610
                        /* Wait for the call to timeout. */
3611
                        finished = mcapi_wait_any(1, req_ptr, &rx_len,
3612
                                                  MCAPI_FTS_TIMEOUT,
3613
                                                  &mcapi_struct->status);
3614
 
3615
                        if ( (finished != 0) ||
3616
                             (mcapi_struct->status != MCAPI_SUCCESS) )
3617
                        {
3618
                            mcapi_struct->status = -1;
3619
                        }
3620
                    }
3621
                }
3622
 
3623
                /* Tell the other side to close the receive side. */
3624
                status =
3625
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3626
                                           MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
3627
                                           1024, mcapi_struct->local_endp,
3628
                                           0, MCAPI_DEFAULT_PRIO);
3629
 
3630
                if (status == MCAPI_SUCCESS)
3631
                {
3632
                    /* Wait for the response. */
3633
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3634
                }
3635
            }
3636
 
3637
            /* Tell the other side to delete the endpoint. */
3638
            status =
3639
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3640
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3641
 
3642
            if (status == MCAPI_SUCCESS)
3643
            {
3644
                /* Wait for the response. */
3645
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3646
            }
3647
        }
3648
    }
3649
 
3650
    /* Set the state of the test to completed. */
3651
    mcapi_struct->state = 0;
3652
 
3653
    /* Allow the next test to run. */
3654
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3655
 
3656
} /* MCAPI_FTS_Tx_2_35_37 */
3657
 
3658
/************************************************************************
3659
*
3660
*   FUNCTION
3661
*
3662
*       MCAPI_FTS_Tx_2_35_38
3663
*
3664
*   DESCRIPTION
3665
*
3666
*       Testing mcapi_wait over mcapi_sclchan_send_close_i - rx opened,
3667
*       connected
3668
*
3669
*           Node 0 - Create endpoint, open receive side
3670
*
3671
*           Node 1 – Create endpoint, issue connection, open send side,
3672
*                    wait for completion.
3673
*
3674
*************************************************************************/
3675
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_38)
3676
{
3677
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3678
    size_t              rx_len;
3679
    mcapi_status_t      status;
3680
    mcapi_boolean_t     finished;
3681
    mcapi_request_t     request;
3682
    mcapi_endpoint_t    rx_endp;
3683
    mcapi_request_t     *req_ptr[1];
3684
 
3685
    /* Don't let any other test run while this test is running. */
3686
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3687
 
3688
    /* Indicate that a remote endpoint should be created. */
3689
    mcapi_struct->status =
3690
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3691
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3692
 
3693
    if (mcapi_struct->status == MCAPI_SUCCESS)
3694
    {
3695
        /* Wait for the response. */
3696
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3697
 
3698
        /* If the endpoint was created. */
3699
        if (mcapi_struct->status == MCAPI_SUCCESS)
3700
        {
3701
            /* Indicate that the endpoint should be opened as a receiver. */
3702
            mcapi_struct->status =
3703
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
3704
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3705
 
3706
            /* Wait for the response. */
3707
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3708
 
3709
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3710
            {
3711
                /* Get the receive side endpoint. */
3712
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
3713
 
3714
                if (mcapi_struct->status == MCAPI_SUCCESS)
3715
                {
3716
                    /* Connect the two endpoints. */
3717
                    mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
3718
                                            &mcapi_struct->request,
3719
                                            &mcapi_struct->status);
3720
 
3721
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3722
                    {
3723
                        /* Wait for the connection to open. */
3724
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
3725
                                   MCAPI_FTS_TIMEOUT);
3726
 
3727
                        if (mcapi_struct->status == MCAPI_SUCCESS)
3728
                        {
3729
                            /* Open the send side. */
3730
                            mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3731
                                                      mcapi_struct->local_endp,
3732
                                                      &request, &mcapi_struct->status);
3733
 
3734
                            if (mcapi_struct->status == MCAPI_SUCCESS)
3735
                            {
3736
                                /* Wait for the send side to open. */
3737
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
3738
                                           MCAPI_FTS_TIMEOUT);
3739
 
3740
                                if (mcapi_struct->status == MCAPI_SUCCESS)
3741
                                {
3742
                                    /* Close the send side. */
3743
                                    mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
3744
                                                               &request, &mcapi_struct->status);
3745
 
3746
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
3747
                                    {
3748
                                        req_ptr[0] = &request;
3749
 
3750
                                        /* Wait for the call to timeout. */
3751
                                        finished = mcapi_wait_any(1, req_ptr,
3752
                                                                  &rx_len,
3753
                                                                  MCAPI_FTS_TIMEOUT,
3754
                                                                  &mcapi_struct->status);
3755
 
3756
                                        if ( (finished != 0) ||
3757
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
3758
                                        {
3759
                                            mcapi_struct->status = -1;
3760
                                        }
3761
                                    }
3762
                                }
3763
                            }
3764
                        }
3765
                    }
3766
                }
3767
 
3768
                /* Tell the other side to close the receive side. */
3769
                status =
3770
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3771
                                           MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
3772
                                           1024, mcapi_struct->local_endp,
3773
                                           0, MCAPI_DEFAULT_PRIO);
3774
 
3775
                if (status == MCAPI_SUCCESS)
3776
                {
3777
                    /* Wait for the response. */
3778
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3779
                }
3780
            }
3781
 
3782
            /* Tell the other side to delete the endpoint. */
3783
            status =
3784
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3785
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3786
 
3787
            if (status == MCAPI_SUCCESS)
3788
            {
3789
                /* Wait for the response. */
3790
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3791
            }
3792
        }
3793
    }
3794
 
3795
    /* Set the state of the test to completed. */
3796
    mcapi_struct->state = 0;
3797
 
3798
    /* Allow the next test to run. */
3799
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3800
 
3801
} /* MCAPI_FTS_Tx_2_35_38 */
3802
 
3803
/************************************************************************
3804
*
3805
*   FUNCTION
3806
*
3807
*       MCAPI_FTS_Tx_2_35_39
3808
*
3809
*   DESCRIPTION
3810
*
3811
*       Testing mcapi_wait_any - Two of the same types, operate on
3812
*       first request – timeout
3813
*
3814
*           Node 1 – Issue get endpoint request for 2 non-existent endpoints
3815
*                    on Node 0, wait for completion
3816
*
3817
*************************************************************************/
3818
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_39)
3819
{
3820
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3821
    mcapi_endpoint_t    endpoint1, endpoint2;
3822
    size_t              rx_len;
3823
    mcapi_status_t      status;
3824
    mcapi_boolean_t     finished;
3825
    mcapi_request_t     *req_ptr[2];
3826
    mcapi_request_t     request1, request2;
3827
 
3828
    /* Don't let any other test run while this test is running. */
3829
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3830
 
3831
    /* Get the first foreign endpoint. */
3832
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint1,
3833
                         &request1, &mcapi_struct->status);
3834
 
3835
    if (mcapi_struct->status == MCAPI_SUCCESS)
3836
    {
3837
        /* Get the second foreign endpoint. */
3838
        mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1025, &endpoint2,
3839
                             &request2, &mcapi_struct->status);
3840
 
3841
        if (mcapi_struct->status == MCAPI_SUCCESS)
3842
        {
3843
            req_ptr[0] = &request1;
3844
            req_ptr[1] = &request2;
3845
 
3846
            /* Wait for the call to timeout. */
3847
            finished = mcapi_wait_any(2, req_ptr, &rx_len, 250,
3848
                                      &mcapi_struct->status);
3849
 
3850
            if (mcapi_struct->status == MCAPI_TIMEOUT)
3851
            {
3852
                mcapi_struct->status = MCAPI_SUCCESS;
3853
            }
3854
 
3855
            else
3856
            {
3857
                mcapi_struct->status = -1;
3858
            }
3859
 
3860
            /* Cancel the second request. */
3861
            mcapi_cancel(&request2, &status);
3862
        }
3863
 
3864
        /* Cancel the first request. */
3865
        mcapi_cancel(&request1, &status);
3866
    }
3867
 
3868
    /* Set the state of the test to completed. */
3869
    mcapi_struct->state = 0;
3870
 
3871
    /* Allow the next test to run. */
3872
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3873
 
3874
} /* MCAPI_FTS_Tx_2_35_39 */
3875
 
3876
/************************************************************************
3877
*
3878
*   FUNCTION
3879
*
3880
*       MCAPI_FTS_Tx_2_35_40
3881
*
3882
*   DESCRIPTION
3883
*
3884
*       Testing mcapi_wait_any - Two of the same types, operate on
3885
*       first request – canceled
3886
*
3887
*           Node 1 – Issue get endpoint request for 2 non-existent endpoints
3888
*                    on Node 0, wait for completion, first request canceled.
3889
*
3890
*************************************************************************/
3891
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_40)
3892
{
3893
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3894
    mcapi_endpoint_t    endpoint1 = 0xffffffff, endpoint2 = 0xffffffff;
3895
    size_t              rx_len;
3896
    mcapi_status_t      status;
3897
    mcapi_boolean_t     finished;
3898
    mcapi_request_t     *req_ptr[2];
3899
    mcapi_request_t     request2;
3900
 
3901
    /* Don't let any other test run while this test is running. */
3902
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3903
 
3904
    /* Get the first foreign endpoint. */
3905
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint1,
3906
                         &mcapi_struct->request, &mcapi_struct->status);
3907
 
3908
    if (mcapi_struct->status == MCAPI_SUCCESS)
3909
    {
3910
        /* Get the second foreign endpoint. */
3911
        mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1025, &endpoint2,
3912
                             &request2, &mcapi_struct->status);
3913
 
3914
        if (mcapi_struct->status == MCAPI_SUCCESS)
3915
        {
3916
            /* Indicate that the request should be canceled in 1000 milliseconds. */
3917
            mcapi_struct->status =
3918
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_CANCEL_REQUEST, 0,
3919
                                       mcapi_struct->local_endp, 1000,
3920
                                       MCAPI_DEFAULT_PRIO);
3921
 
3922
            req_ptr[0] = &mcapi_struct->request;
3923
            req_ptr[1] = &request2;
3924
 
3925
            /* Wait for the call to timeout. */
3926
            finished = mcapi_wait_any(2, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
3927
                                      &mcapi_struct->status);
3928
 
3929
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
3930
                 (finished == 0) )
3931
            {
3932
                mcapi_struct->status = MCAPI_SUCCESS;
3933
            }
3934
 
3935
            else
3936
            {
3937
                /* Cancel the first request. */
3938
                mcapi_cancel(&mcapi_struct->request, &status);
3939
 
3940
                mcapi_struct->status = -1;
3941
            }
3942
 
3943
            /* Cancel the second request. */
3944
            mcapi_cancel(&request2, &status);
3945
        }
3946
 
3947
        else
3948
        {
3949
            /* Cancel the first request. */
3950
            mcapi_cancel(&mcapi_struct->request, &status);
3951
        }
3952
 
3953
        /* Wait for a response that the cancel was successful. */
3954
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3955
    }
3956
 
3957
    /* Set the state of the test to completed. */
3958
    mcapi_struct->state = 0;
3959
 
3960
    /* Allow the next test to run. */
3961
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3962
 
3963
} /* MCAPI_FTS_Tx_2_35_40 */
3964
 
3965
/************************************************************************
3966
*
3967
*   FUNCTION
3968
*
3969
*       MCAPI_FTS_Tx_2_35_41
3970
*
3971
*   DESCRIPTION
3972
*
3973
*       Testing mcapi_wait_any - Two of the same types, operate on
3974
*       first request – complete
3975
*
3976
*           Node 0 – Wait for get endpoint request, create endpoint
3977
*
3978
*           Node 1 – Issue get endpoint request for non-existent endpoint
3979
*                    on Node 0, wait for completion
3980
*
3981
*************************************************************************/
3982
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_41)
3983
{
3984
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3985
    mcapi_endpoint_t    endpoint1 = 0xffffffff, endpoint2 = 0xffffffff;
3986
    size_t              rx_len;
3987
    mcapi_status_t      status;
3988
    mcapi_boolean_t     finished;
3989
    mcapi_request_t     *req_ptr[2];
3990
    mcapi_request_t     request1, request2;
3991
 
3992
    /* Don't let any other test run while this test is running. */
3993
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3994
 
3995
    /* Get the first foreign endpoint. */
3996
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint1,
3997
                         &request1, &mcapi_struct->status);
3998
 
3999
    if (mcapi_struct->status == MCAPI_SUCCESS)
4000
    {
4001
        /* Get the second foreign endpoint. */
4002
        mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1025, &endpoint2,
4003
                             &request2, &mcapi_struct->status);
4004
 
4005
        if (mcapi_struct->status == MCAPI_SUCCESS)
4006
        {
4007
            /* Indicate that the endpoint should be created in 500 milliseconds. */
4008
            mcapi_struct->status =
4009
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
4010
                                       mcapi_struct->local_endp, 500,
4011
                                       MCAPI_DEFAULT_PRIO);
4012
 
4013
            req_ptr[0] = &request1;
4014
            req_ptr[1] = &request2;
4015
 
4016
            /* Wait for the call to timeout. */
4017
            finished = mcapi_wait_any(2, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
4018
                                      &mcapi_struct->status);
4019
 
4020
            if ( (finished != 0) ||
4021
                 (mcapi_struct->status != MCAPI_SUCCESS) )
4022
            {
4023
                /* Cancel the first request. */
4024
                mcapi_cancel(&request1, &status);
4025
 
4026
                mcapi_struct->status = -1;
4027
            }
4028
 
4029
            /* Wait for a response that the creation was successful. */
4030
            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
4031
 
4032
            if (status == MCAPI_SUCCESS)
4033
            {
4034
                /* Indicate that the endpoint should be deleted. */
4035
                status =
4036
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
4037
                                           mcapi_struct->local_endp, 0,
4038
                                           MCAPI_DEFAULT_PRIO);
4039
 
4040
                if (status == MCAPI_SUCCESS)
4041
                {
4042
                    /* Wait for a response that the endpoint was deleted. */
4043
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
4044
                }
4045
            }
4046
 
4047
            /* Cancel the second request. */
4048
            mcapi_cancel(&request2, &status);
4049
        }
4050
 
4051
        else
4052
        {
4053
            /* Cancel the first request. */
4054
            mcapi_cancel(&request1, &status);
4055
        }
4056
    }
4057
 
4058
    /* Set the state of the test to completed. */
4059
    mcapi_struct->state = 0;
4060
 
4061
    /* Allow the next test to run. */
4062
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
4063
 
4064
} /* MCAPI_FTS_Tx_2_35_41 */
4065
 
4066
/************************************************************************
4067
*
4068
*   FUNCTION
4069
*
4070
*       MCAPI_FTS_Tx_2_35_42
4071
*
4072
*   DESCRIPTION
4073
*
4074
*       Testing mcapi_wait_any while getting 2 foreign endpoints - second
4075
*       request canceled
4076
*
4077
*           Node 1 – Issue get endpoint request for 2 non-existent endpoints
4078
*                    on Node 0, wait for completion, second request canceled.
4079
*
4080
*************************************************************************/
4081
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_42)
4082
{
4083
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
4084
    mcapi_endpoint_t    endpoint1 = 0xffffffff, endpoint2 = 0xffffffff;
4085
    size_t              rx_len;
4086
    mcapi_status_t      status;
4087
    mcapi_boolean_t     finished;
4088
    mcapi_request_t     *req_ptr[2];
4089
    mcapi_request_t     request1;
4090
 
4091
    /* Don't let any other test run while this test is running. */
4092
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
4093
 
4094
    /* Get the first foreign endpoint. */
4095
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint1,
4096
                         &request1, &mcapi_struct->status);
4097
 
4098
    if (mcapi_struct->status == MCAPI_SUCCESS)
4099
    {
4100
        /* Get the second foreign endpoint. */
4101
        mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1025, &endpoint2,
4102
                             &mcapi_struct->request, &mcapi_struct->status);
4103
 
4104
        if (mcapi_struct->status == MCAPI_SUCCESS)
4105
        {
4106
            /* Indicate that the request should be canceled in 1000 milliseconds. */
4107
            mcapi_struct->status =
4108
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_CANCEL_REQUEST, 0,
4109
                                       mcapi_struct->local_endp, 1000,
4110
                                       MCAPI_DEFAULT_PRIO);
4111
 
4112
            req_ptr[0] = &request1;
4113
            req_ptr[1] = &mcapi_struct->request;
4114
 
4115
            /* Wait for the call to timeout. */
4116
            finished = mcapi_wait_any(2, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
4117
                                      &mcapi_struct->status);
4118
 
4119
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
4120
                 (finished == 1) )
4121
            {
4122
                mcapi_struct->status = MCAPI_SUCCESS;
4123
            }
4124
 
4125
            else
4126
            {
4127
                /* Cancel the second request. */
4128
                mcapi_cancel(&mcapi_struct->request, &status);
4129
 
4130
                mcapi_struct->status = -1;
4131
            }
4132
 
4133
            /* Cancel the first request. */
4134
            mcapi_cancel(&request1, &status);
4135
        }
4136
 
4137
        else
4138
        {
4139
            /* Cancel the first request. */
4140
            mcapi_cancel(&mcapi_struct->request, &status);
4141
        }
4142
 
4143
        /* Wait for a response that the cancel was successful. */
4144
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
4145
    }
4146
 
4147
    /* Set the state of the test to completed. */
4148
    mcapi_struct->state = 0;
4149
 
4150
    /* Allow the next test to run. */
4151
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
4152
 
4153
} /* MCAPI_FTS_Tx_2_35_42 */
4154
 
4155
/************************************************************************
4156
*
4157
*   FUNCTION
4158
*
4159
*       MCAPI_FTS_Tx_2_35_43
4160
*
4161
*   DESCRIPTION
4162
*
4163
*       Testing mcapi_wait_any - Two of the different types, operate on
4164
*       second request – complete
4165
*
4166
*           Node 0 – Wait for get endpoint requests, create second endpoint
4167
*
4168
*           Node 1 – Issue get endpoint request for 2 non-existent endpoints
4169
*                    on Node 0, wait for completion
4170
*
4171
*************************************************************************/
4172
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_43)
4173
{
4174
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
4175
    mcapi_endpoint_t    endpoint1 = 0xffffffff, endpoint2 = 0xffffffff;
4176
    size_t              rx_len;
4177
    mcapi_status_t      status;
4178
    mcapi_boolean_t     finished;
4179
    mcapi_request_t     *req_ptr[2];
4180
    mcapi_request_t     request1, request2;
4181
 
4182
    /* Don't let any other test run while this test is running. */
4183
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
4184
 
4185
    /* Get the first foreign endpoint. */
4186
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint1,
4187
                         &request1, &mcapi_struct->status);
4188
 
4189
    if (mcapi_struct->status == MCAPI_SUCCESS)
4190
    {
4191
        /* Get the second foreign endpoint. */
4192
        mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1025, &endpoint2,
4193
                             &request2, &mcapi_struct->status);
4194
 
4195
        if (mcapi_struct->status == MCAPI_SUCCESS)
4196
        {
4197
            /* Indicate that the endpoint should be created in 500 milliseconds. */
4198
            mcapi_struct->status =
4199
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1025,
4200
                                       mcapi_struct->local_endp, 500,
4201
                                       MCAPI_DEFAULT_PRIO);
4202
 
4203
            req_ptr[0] = &request1;
4204
            req_ptr[1] = &request2;
4205
 
4206
            /* Wait for the call to timeout. */
4207
            finished = mcapi_wait_any(2, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
4208
                                      &mcapi_struct->status);
4209
 
4210
            if ( (finished != 1) ||
4211
                 (mcapi_struct->status != MCAPI_SUCCESS) )
4212
            {
4213
                /* Cancel the second request. */
4214
                mcapi_cancel(&request2, &status);
4215
 
4216
                mcapi_struct->status = -1;
4217
            }
4218
 
4219
            /* Wait for a response that the creation was successful. */
4220
            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
4221
 
4222
            if (status == MCAPI_SUCCESS)
4223
            {
4224
                /* Indicate that the endpoint should be deleted. */
4225
                status =
4226
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1025,
4227
                                           mcapi_struct->local_endp, 0,
4228
                                           MCAPI_DEFAULT_PRIO);
4229
 
4230
                if (status == MCAPI_SUCCESS)
4231
                {
4232
                    /* Wait for a response that the endpoint was deleted. */
4233
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
4234
                }
4235
            }
4236
 
4237
            /* Cancel the first request. */
4238
            mcapi_cancel(&request1, &status);
4239
        }
4240
 
4241
        else
4242
        {
4243
            /* Cancel the first request. */
4244
            mcapi_cancel(&request1, &status);
4245
        }
4246
    }
4247
 
4248
    /* Set the state of the test to completed. */
4249
    mcapi_struct->state = 0;
4250
 
4251
    /* Allow the next test to run. */
4252
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
4253
 
4254
} /* MCAPI_FTS_Tx_2_35_43 */
4255
 
4256
/************************************************************************
4257
*
4258
*   FUNCTION
4259
*
4260
*       MCAPI_FTS_Tx_2_35_44
4261
*
4262
*   DESCRIPTION
4263
*
4264
*       Testing mcapi_wait_any - Two of the different types, operate on
4265
*       first request – timeout
4266
*
4267
*           Node 1 – Issue get endpoint request for a non-existent endpoint
4268
*                    on Node 0, and issue a receive message request, wait
4269
*                    for timeout
4270
*
4271
*************************************************************************/
4272
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_44)
4273
{
4274
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
4275
    mcapi_endpoint_t    endpoint;
4276
    size_t              rx_len;
4277
    mcapi_status_t      status;
4278
    mcapi_boolean_t     finished;
4279
    mcapi_request_t     *req_ptr[2];
4280
    mcapi_request_t     request1, request2;
4281
    char                buffer[MCAPID_MGMT_PKT_LEN];
4282
 
4283
    /* Don't let any other test run while this test is running. */
4284
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
4285
 
4286
    /* Get a foreign endpoint. */
4287
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
4288
                         &request1, &mcapi_struct->status);
4289
 
4290
    if (mcapi_struct->status == MCAPI_SUCCESS)
4291
    {
4292
        /* Issue a receive message call. */
4293
        mcapi_msg_recv_i(mcapi_struct->local_endp, buffer, MCAPID_MGMT_PKT_LEN,
4294
                         &request2, &mcapi_struct->status);
4295
 
4296
        if (mcapi_struct->status == MCAPI_SUCCESS)
4297
        {
4298
            req_ptr[0] = &request1;
4299
            req_ptr[1] = &request2;
4300
 
4301
            /* Wait for the call to timeout. */
4302
            finished = mcapi_wait_any(2, req_ptr, &rx_len, 250,
4303
                                      &mcapi_struct->status);
4304
 
4305
            if (mcapi_struct->status == MCAPI_TIMEOUT)
4306
            {
4307
                mcapi_struct->status = MCAPI_SUCCESS;
4308
            }
4309
 
4310
            else
4311
            {
4312
                mcapi_struct->status = -1;
4313
            }
4314
 
4315
            /* Cancel the second request. */
4316
            mcapi_cancel(&request2, &status);
4317
        }
4318
 
4319
        /* Cancel the first request. */
4320
        mcapi_cancel(&request1, &status);
4321
    }
4322
 
4323
    /* Set the state of the test to completed. */
4324
    mcapi_struct->state = 0;
4325
 
4326
    /* Allow the next test to run. */
4327
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
4328
 
4329
} /* MCAPI_FTS_Tx_2_35_44 */
4330
 
4331
/************************************************************************
4332
*
4333
*   FUNCTION
4334
*
4335
*       MCAPI_FTS_Tx_2_35_45
4336
*
4337
*   DESCRIPTION
4338
*
4339
*       Testing mcapi_wait_any - Two of the different types, operate on
4340
*       first request – canceled
4341
*
4342
*           Node 1 – Issue get endpoint request for a non-existent endpoint
4343
*                    on Node 0, and issue a receive message request, wait
4344
*                    for first request to be canceled
4345
*
4346
*************************************************************************/
4347
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_45)
4348
{
4349
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
4350
    mcapi_endpoint_t    endpoint1 = 0xffffffff;
4351
    size_t              rx_len;
4352
    mcapi_status_t      status;
4353
    mcapi_boolean_t     finished;
4354
    mcapi_request_t     *req_ptr[2];
4355
    mcapi_request_t     request2;
4356
    char                buffer[MCAPID_MGMT_PKT_LEN];
4357
    mcapi_endpoint_t    rx_endp;
4358
 
4359
    /* Don't let any other test run while this test is running. */
4360
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
4361
 
4362
    /* An extra endpoint is required for this test. */
4363
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
4364
 
4365
    if (mcapi_struct->status == MCAPI_SUCCESS)
4366
    {
4367
        /* Get a foreign endpoint. */
4368
        mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint1,
4369
                             &mcapi_struct->request, &mcapi_struct->status);
4370
 
4371
        if (mcapi_struct->status == MCAPI_SUCCESS)
4372
        {
4373
            /* Issue a receive message call. */
4374
            mcapi_msg_recv_i(rx_endp, buffer, MCAPID_MGMT_PKT_LEN,
4375
                             &request2, &mcapi_struct->status);
4376
 
4377
            if (mcapi_struct->status == MCAPI_SUCCESS)
4378
            {
4379
                /* Indicate that the request should be canceled in 1000 milliseconds. */
4380
                mcapi_struct->status =
4381
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_CANCEL_REQUEST, 0,
4382
                                           mcapi_struct->local_endp, 1000,
4383
                                           MCAPI_DEFAULT_PRIO);
4384
 
4385
                req_ptr[0] = &mcapi_struct->request;
4386
                req_ptr[1] = &request2;
4387
 
4388
                /* Wait for the call to timeout. */
4389
                finished = mcapi_wait_any(2, req_ptr, &rx_len,
4390
                                          MCAPI_FTS_TIMEOUT,
4391
                                          &mcapi_struct->status);
4392
 
4393
                if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
4394
                     (finished == 0) )
4395
                {
4396
                    mcapi_struct->status = MCAPI_SUCCESS;
4397
                }
4398
 
4399
                else
4400
                {
4401
                    /* Cancel the first request. */
4402
                    mcapi_cancel(&mcapi_struct->request, &status);
4403
 
4404
                    mcapi_struct->status = -1;
4405
                }
4406
 
4407
                /* Cancel the second request. */
4408
                mcapi_cancel(&request2, &status);
4409
            }
4410
 
4411
            else
4412
            {
4413
                /* Cancel the first request. */
4414
                mcapi_cancel(&mcapi_struct->request, &status);
4415
            }
4416
 
4417
            /* Wait for a response that the cancel was successful. */
4418
            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
4419
        }
4420
 
4421
        /* Delete the extra endpoint. */
4422
        mcapi_delete_endpoint(rx_endp, &status);
4423
    }
4424
 
4425
    /* Set the state of the test to completed. */
4426
    mcapi_struct->state = 0;
4427
 
4428
    /* Allow the next test to run. */
4429
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
4430
 
4431
} /* MCAPI_FTS_Tx_2_35_45 */
4432
 
4433
/************************************************************************
4434
*
4435
*   FUNCTION
4436
*
4437
*       MCAPI_FTS_Tx_2_35_46
4438
*
4439
*   DESCRIPTION
4440
*
4441
*       Testing mcapi_wait_any - Two of the different types, operate on
4442
*       first request – complete
4443
*
4444
*           Node 0 – Wait for get endpoint request, create endpoint
4445
*
4446
*           Node 1 – Issue get endpoint request for a non-existent endpoint
4447
*                    on Node 0, and issue a receive message request, wait
4448
*                    for first request to be complete
4449
*
4450
*************************************************************************/
4451
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_46)
4452
{
4453
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
4454
    mcapi_endpoint_t    endpoint1 = 0xffffffff;
4455
    size_t              rx_len;
4456
    mcapi_status_t      status;
4457
    mcapi_boolean_t     finished;
4458
    mcapi_request_t     *req_ptr[2];
4459
    mcapi_request_t     request1, request2;
4460
    char                buffer[MCAPID_MGMT_PKT_LEN];
4461
    mcapi_endpoint_t    rx_endp;
4462
 
4463
    /* Don't let any other test run while this test is running. */
4464
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
4465
 
4466
    /* An extra endpoint is required for this test. */
4467
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
4468
 
4469
    if (mcapi_struct->status == MCAPI_SUCCESS)
4470
    {
4471
        /* Get the first foreign endpoint. */
4472
        mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint1,
4473
                             &request1, &mcapi_struct->status);
4474
 
4475
        if (mcapi_struct->status == MCAPI_SUCCESS)
4476
        {
4477
            /* Issue a receive message call. */
4478
            mcapi_msg_recv_i(rx_endp, buffer, MCAPID_MGMT_PKT_LEN,
4479
                             &request2, &mcapi_struct->status);
4480
 
4481
            if (mcapi_struct->status == MCAPI_SUCCESS)
4482
            {
4483
                /* Indicate that the endpoint should be created in 500 milliseconds. */
4484
                mcapi_struct->status =
4485
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
4486
                                           mcapi_struct->local_endp, 500,
4487
                                           MCAPI_DEFAULT_PRIO);
4488
 
4489
                req_ptr[0] = &request1;
4490
                req_ptr[1] = &request2;
4491
 
4492
                /* Wait for the call to timeout. */
4493
                finished = mcapi_wait_any(2, req_ptr, &rx_len,
4494
                                          MCAPI_FTS_TIMEOUT,
4495
                                          &mcapi_struct->status);
4496
 
4497
                if ( (finished != 0) ||
4498
                     (mcapi_struct->status != MCAPI_SUCCESS) )
4499
                {
4500
                    /* Cancel the first request. */
4501
                    mcapi_cancel(&request1, &status);
4502
 
4503
                    mcapi_struct->status = -1;
4504
                }
4505
 
4506
                /* Wait for a response that the creation was successful. */
4507
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
4508
 
4509
                if (status == MCAPI_SUCCESS)
4510
                {
4511
                    /* Indicate that the endpoint should be deleted. */
4512
                    status =
4513
                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
4514
                                               mcapi_struct->local_endp, 0,
4515
                                               MCAPI_DEFAULT_PRIO);
4516
 
4517
                    if (status == MCAPI_SUCCESS)
4518
                    {
4519
                        /* Wait for a response that the endpoint was deleted. */
4520
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
4521
                    }
4522
                }
4523
 
4524
                /* Cancel the second request. */
4525
                mcapi_cancel(&request2, &status);
4526
            }
4527
 
4528
            else
4529
            {
4530
                /* Cancel the first request. */
4531
                mcapi_cancel(&request1, &status);
4532
            }
4533
        }
4534
 
4535
        /* Delete the extra endpoint. */
4536
        mcapi_delete_endpoint(rx_endp, &status);
4537
    }
4538
 
4539
    /* Set the state of the test to completed. */
4540
    mcapi_struct->state = 0;
4541
 
4542
    /* Allow the next test to run. */
4543
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
4544
 
4545
} /* MCAPI_FTS_Tx_2_35_46 */
4546
 
4547
/************************************************************************
4548
*
4549
*   FUNCTION
4550
*
4551
*       MCAPI_FTS_Tx_2_35_47
4552
*
4553
*   DESCRIPTION
4554
*
4555
*       Testing mcapi_wait_any - Two of the different types, operate on
4556
*       second request – canceled
4557
*
4558
*           Node 1 – Issue get endpoint request for a non-existent endpoint
4559
*                    on Node 0, and issue a receive message request, wait
4560
*                    for second request to be canceled
4561
*
4562
*************************************************************************/
4563
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_47)
4564
{
4565
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
4566
    mcapi_endpoint_t    endpoint1 = 0xffffffff;
4567
    size_t              rx_len;
4568
    mcapi_status_t      status;
4569
    mcapi_boolean_t     finished;
4570
    mcapi_request_t     *req_ptr[2];
4571
    mcapi_request_t     request1;
4572
    char                buffer[MCAPID_MGMT_PKT_LEN];
4573
    mcapi_endpoint_t    rx_endp;
4574
 
4575
    /* Don't let any other test run while this test is running. */
4576
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
4577
 
4578
    /* An extra endpoint is required for this test. */
4579
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
4580
 
4581
    if (mcapi_struct->status == MCAPI_SUCCESS)
4582
    {
4583
        /* Get a foreign endpoint. */
4584
        mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint1,
4585
                             &request1, &mcapi_struct->status);
4586
 
4587
        if (mcapi_struct->status == MCAPI_SUCCESS)
4588
        {
4589
            /* Issue a receive message call. */
4590
            mcapi_msg_recv_i(rx_endp, buffer, MCAPID_MGMT_PKT_LEN,
4591
                             &mcapi_struct->request, &mcapi_struct->status);
4592
 
4593
            if (mcapi_struct->status == MCAPI_SUCCESS)
4594
            {
4595
                /* Indicate that the request should be canceled in 1000 milliseconds. */
4596
                mcapi_struct->status =
4597
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_CANCEL_REQUEST, 0,
4598
                                           mcapi_struct->local_endp, 1000,
4599
                                           MCAPI_DEFAULT_PRIO);
4600
 
4601
                req_ptr[0] = &request1;
4602
                req_ptr[1] = &mcapi_struct->request;
4603
 
4604
                /* Wait for the call to timeout. */
4605
                finished = mcapi_wait_any(2, req_ptr, &rx_len,
4606
                                          MCAPI_FTS_TIMEOUT,
4607
                                          &mcapi_struct->status);
4608
 
4609
                if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
4610
                     (finished == 1) )
4611
                {
4612
                    mcapi_struct->status = MCAPI_SUCCESS;
4613
                }
4614
 
4615
                else
4616
                {
4617
                    /* Cancel the second request. */
4618
                    mcapi_cancel(&mcapi_struct->request, &status);
4619
 
4620
                    mcapi_struct->status = -1;
4621
                }
4622
            }
4623
 
4624
            /* Cancel the first request. */
4625
            mcapi_cancel(&request1, &status);
4626
 
4627
            /* Wait for a response that the cancel was successful. */
4628
            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
4629
        }
4630
 
4631
        /* Delete the extra endpoint. */
4632
        mcapi_delete_endpoint(rx_endp, &status);
4633
    }
4634
 
4635
    /* Set the state of the test to completed. */
4636
    mcapi_struct->state = 0;
4637
 
4638
    /* Allow the next test to run. */
4639
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
4640
 
4641
} /* MCAPI_FTS_Tx_2_35_47 */
4642
 
4643
/************************************************************************
4644
*
4645
*   FUNCTION
4646
*
4647
*       MCAPI_FTS_Tx_2_35_48
4648
*
4649
*   DESCRIPTION
4650
*
4651
*       Testing mcapi_wait_any - Two of the different types, operate on
4652
*       second request – complete
4653
*
4654
*           Node 0 – Wait for get data request, send data
4655
*
4656
*           Node 1 – Issue get endpoin9t request for a non-existent endpoint
4657
*                    on Node 0, and issue a receive message request, wait
4658
*                    for second request to be complete
4659
*
4660
*************************************************************************/
4661
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_48)
4662
{
4663
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
4664
    mcapi_endpoint_t    endpoint1 = 0xffffffff;
4665
    size_t              rx_len;
4666
    mcapi_status_t      status;
4667
    mcapi_boolean_t     finished;
4668
    mcapi_request_t     *req_ptr[2];
4669
    mcapi_request_t     request1, request2;
4670
    char                buffer[MCAPID_MGMT_PKT_LEN];
4671
 
4672
    /* Don't let any other test run while this test is running. */
4673
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
4674
 
4675
    /* Get the first foreign endpoint. */
4676
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint1,
4677
                         &request1, &mcapi_struct->status);
4678
 
4679
    if (mcapi_struct->status == MCAPI_SUCCESS)
4680
    {
4681
        /* Issue a receive message call. */
4682
        mcapi_msg_recv_i(mcapi_struct->local_endp, buffer, MCAPID_MGMT_PKT_LEN,
4683
                         &request2, &mcapi_struct->status);
4684
 
4685
        if (mcapi_struct->status == MCAPI_SUCCESS)
4686
        {
4687
            /* Indicate that data should be sent in 500 milliseconds. */
4688
            mcapi_struct->status =
4689
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_NO_OP, 1024,
4690
                                       mcapi_struct->local_endp, 500,
4691
                                       MCAPI_DEFAULT_PRIO);
4692
 
4693
            req_ptr[0] = &request1;
4694
            req_ptr[1] = &request2;
4695
 
4696
            /* Wait for the call to succeed. */
4697
            finished = mcapi_wait_any(2, req_ptr, &rx_len, MCAPI_FTS_TIMEOUT,
4698
                                      &mcapi_struct->status);
4699
 
4700
            if ( (finished != 1) ||
4701
                 (mcapi_struct->status != MCAPI_SUCCESS) )
4702
            {
4703
                /* Cancel the second request. */
4704
                mcapi_cancel(&request2, &status);
4705
 
4706
                mcapi_struct->status = -1;
4707
            }
4708
        }
4709
 
4710
        /* Cancel the first request. */
4711
        mcapi_cancel(&request1, &status);
4712
    }
4713
 
4714
    /* Set the state of the test to completed. */
4715
    mcapi_struct->state = 0;
4716
 
4717
    /* Allow the next test to run. */
4718
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
4719
 
4720
} /* MCAPI_FTS_Tx_2_35_48 */
4721
 
4722
/************************************************************************
4723
*
4724
*   FUNCTION
4725
*
4726
*       MCAPI_FTS_Tx_2_35_49
4727
*
4728
*   DESCRIPTION
4729
*
4730
*       Testing mcapi_wait_any - Two of the different types, operate on
4731
*       first request – timeout
4732
*
4733
*           Node 1 – Open receive side of packet channel, open send side
4734
*                    of packet channel, wait for timeout
4735
*
4736
*************************************************************************/
4737
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_49)
4738
{
4739
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
4740
    size_t              rx_len;
4741
    mcapi_status_t      status;
4742
    mcapi_boolean_t     finished;
4743
    mcapi_request_t     *req_ptr[2];
4744
    mcapi_request_t     request1, request2;
4745
    mcapi_endpoint_t    rx_endp, tx_endp;
4746
 
4747
    /* Don't let any other test run while this test is running. */
4748
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
4749
 
4750
    /* Two extra endpoints are required for this test. */
4751
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
4752
 
4753
    if (mcapi_struct->status == MCAPI_SUCCESS)
4754
    {
4755
        tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
4756
 
4757
        if (mcapi_struct->status == MCAPI_SUCCESS)
4758
        {
4759
            /* Open the receive side of the packet channel. */
4760
            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle, rx_endp,
4761
                                      &request1, &mcapi_struct->status);
4762
 
4763
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
4764
            {
4765
                /* Open the send side of the packet channel. */
4766
                mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle, tx_endp,
4767
                                          &request2, &mcapi_struct->status);
4768
 
4769
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
4770
                {
4771
                    req_ptr[0] = &request1;
4772
                    req_ptr[1] = &request2;
4773
 
4774
                    /* Wait for the call to timeout. */
4775
                    finished = mcapi_wait_any(2, req_ptr, &rx_len, 250,
4776
                                              &mcapi_struct->status);
4777
 
4778
                    if (mcapi_struct->status == MCAPI_TIMEOUT)
4779
                    {
4780
                        mcapi_struct->status = MCAPI_SUCCESS;
4781
                    }
4782
 
4783
                    else
4784
                    {
4785
                        mcapi_struct->status = -1;
4786
                    }
4787
 
4788
                    /* Cancel the second request. */
4789
                    mcapi_cancel(&request2, &status);
4790
                }
4791
 
4792
                /* Cancel the first request. */
4793
                mcapi_cancel(&request1, &status);
4794
            }
4795
 
4796
            /* Delete the extra endpoint. */
4797
            mcapi_delete_endpoint(tx_endp, &status);
4798
        }
4799
 
4800
        /* Delete the extra endpoint. */
4801
        mcapi_delete_endpoint(rx_endp, &status);
4802
    }
4803
 
4804
    /* Set the state of the test to completed. */
4805
    mcapi_struct->state = 0;
4806
 
4807
    /* Allow the next test to run. */
4808
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
4809
 
4810
} /* MCAPI_FTS_Tx_2_35_49 */
4811
 
4812
/************************************************************************
4813
*
4814
*   FUNCTION
4815
*
4816
*       MCAPI_FTS_Tx_2_35_50
4817
*
4818
*   DESCRIPTION
4819
*
4820
*       Testing mcapi_wait_any - Two of the different types, operate on
4821
*       first request – canceled
4822
*
4823
*           Node 1 – Open receive side of packet channel, open send side of
4824
*                    packet channel, cancel first request, wait for
4825
*                    cancellation.
4826
*
4827
*************************************************************************/
4828
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_50)
4829
{
4830
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
4831
    size_t              rx_len;
4832
    mcapi_status_t      status;
4833
    mcapi_boolean_t     finished;
4834
    mcapi_request_t     *req_ptr[2];
4835
    mcapi_request_t     request2;
4836
    mcapi_endpoint_t    rx_endp, tx_endp;
4837
 
4838
    /* Don't let any other test run while this test is running. */
4839
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
4840
 
4841
    /* Two extra endpoints are required for this test. */
4842
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
4843
 
4844
    if (mcapi_struct->status == MCAPI_SUCCESS)
4845
    {
4846
        tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
4847
 
4848
        if (mcapi_struct->status == MCAPI_SUCCESS)
4849
        {
4850
            /* Open the receive side of the packet channel. */
4851
            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle, rx_endp,
4852
                                      &mcapi_struct->request, &mcapi_struct->status);
4853
 
4854
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
4855
            {
4856
                /* Open the send side of the packet channel. */
4857
                mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle, tx_endp,
4858
                                          &request2, &mcapi_struct->status);
4859
 
4860
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
4861
                {
4862
                    /* Indicate that the request should be canceled in 1000 milliseconds. */
4863
                    mcapi_struct->status =
4864
                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_CANCEL_REQUEST, 0,
4865
                                               mcapi_struct->local_endp, 1000,
4866
                                               MCAPI_DEFAULT_PRIO);
4867
 
4868
                    req_ptr[0] = &mcapi_struct->request;
4869
                    req_ptr[1] = &request2;
4870
 
4871
                    /* Wait for the call to timeout. */
4872
                    finished = mcapi_wait_any(2, req_ptr, &rx_len,
4873
                                              MCAPI_FTS_TIMEOUT,
4874
                                              &mcapi_struct->status);
4875
 
4876
                    if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
4877
                         (finished == 0) )
4878
                    {
4879
                        mcapi_struct->status = MCAPI_SUCCESS;
4880
                    }
4881
 
4882
                    else
4883
                    {
4884
                        /* Cancel the first request. */
4885
                        mcapi_cancel(&mcapi_struct->request, &status);
4886
 
4887
                        mcapi_struct->status = -1;
4888
                    }
4889
 
4890
                    /* Wait for a response that the cancel was successful. */
4891
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
4892
 
4893
                    /* Cancel the second request. */
4894
                    mcapi_cancel(&request2, &status);
4895
                }
4896
 
4897
                else
4898
                {
4899
                    /* Cancel the first request. */
4900
                    mcapi_cancel(&mcapi_struct->request, &status);
4901
                }
4902
            }
4903
 
4904
            /* Delete the extra endpoint. */
4905
            mcapi_delete_endpoint(tx_endp, &status);
4906
        }
4907
 
4908
        /* Delete the extra endpoint. */
4909
        mcapi_delete_endpoint(rx_endp, &status);
4910
    }
4911
 
4912
    /* Set the state of the test to completed. */
4913
    mcapi_struct->state = 0;
4914
 
4915
    /* Allow the next test to run. */
4916
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
4917
 
4918
} /* MCAPI_FTS_Tx_2_35_50 */
4919
 
4920
/************************************************************************
4921
*
4922
*   FUNCTION
4923
*
4924
*       MCAPI_FTS_Tx_2_35_51
4925
*
4926
*   DESCRIPTION
4927
*
4928
*       Testing mcapi_wait_any - Two of the different types, operate on
4929
*       first request – complete
4930
*
4931
*           Node 0 – Wait for get endpoint request, create endpoint
4932
*
4933
*           Node 1 – Issue get endpoint request for a non-existent endpoint
4934
*                    on Node 0, and issue a receive message request, wait
4935
*                    for first request to be complete
4936
*
4937
*************************************************************************/
4938
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_51)
4939
{
4940
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
4941
    size_t              rx_len;
4942
    mcapi_status_t      status;
4943
    mcapi_boolean_t     finished;
4944
    mcapi_request_t     *req_ptr[2];
4945
    mcapi_request_t     request1, request2;
4946
    mcapi_endpoint_t    rx_endp, tx_endp, foreign_tx_endp;
4947
 
4948
    /* Don't let any other test run while this test is running. */
4949
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
4950
 
4951
    /* Indicate that an endpoint should be created. */
4952
    mcapi_struct->status =
4953
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP,
4954
                               1024, mcapi_struct->local_endp, 0,
4955
                               MCAPI_DEFAULT_PRIO);
4956
 
4957
    if (mcapi_struct->status == MCAPI_SUCCESS)
4958
    {
4959
        /* Wait for a response that the endpoint was created. */
4960
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
4961
 
4962
        if (mcapi_struct->status == MCAPI_SUCCESS)
4963
        {
4964
            /* Get the foreign endpoint. */
4965
            foreign_tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024,
4966
                                                 &mcapi_struct->status);
4967
 
4968
            if (mcapi_struct->status == MCAPI_SUCCESS)
4969
            {
4970
                /* Two extra endpoints are required for this test. */
4971
                rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
4972
 
4973
                if (mcapi_struct->status == MCAPI_SUCCESS)
4974
                {
4975
                    tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
4976
 
4977
                    if (mcapi_struct->status == MCAPI_SUCCESS)
4978
                    {
4979
                        /* Open the receive side of the packet channel. */
4980
                        mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle, rx_endp,
4981
                                                  &request1, &mcapi_struct->status);
4982
 
4983
                        if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
4984
                        {
4985
                            /* Open the send side of the packet channel. */
4986
                            mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle, tx_endp,
4987
                                                      &request2, &mcapi_struct->status);
4988
 
4989
                            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
4990
                            {
4991
                                /* Issue the connection. */
4992
                                mcapi_connect_pktchan_i(foreign_tx_endp, rx_endp,
4993
                                                        &mcapi_struct->request,
4994
                                                        &mcapi_struct->status);
4995
 
4996
                                if (mcapi_struct->status == MCAPI_SUCCESS)
4997
                                {
4998
                                    /* Wait for the connect to complete. */
4999
                                    mcapi_wait(&mcapi_struct->request, &rx_len,
5000
                                               &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
5001
 
5002
                                    /* Indicate that the send side should be opened in
5003
                                     * 500 milliseconds.
5004
                                     */
5005
                                    mcapi_struct->status =
5006
                                        MCAPID_TX_Mgmt_Message(mcapi_struct,
5007
                                                               MCAPID_MGMT_OPEN_TX_SIDE_PKT,
5008
                                                               1024, mcapi_struct->local_endp,
5009
                                                               500, MCAPI_DEFAULT_PRIO);
5010
 
5011
                                    req_ptr[0] = &request1;
5012
                                    req_ptr[1] = &request2;
5013
 
5014
                                    /* Wait for the open to complete. */
5015
                                    finished = mcapi_wait_any(2, req_ptr,
5016
                                                              &rx_len,
5017
                                                              MCAPI_FTS_TIMEOUT,
5018
                                                              &mcapi_struct->status);
5019
 
5020
                                    if ( (finished != 0) ||
5021
                                         (mcapi_struct->status != MCAPI_SUCCESS) )
5022
                                    {
5023
                                        /* Cancel the first request. */
5024
                                        mcapi_cancel(&request1, &status);
5025
 
5026
                                        mcapi_struct->status = -1;
5027
                                    }
5028
 
5029
                                    else
5030
                                    {
5031
                                        /* Wait for a response that the open was successful. */
5032
                                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5033
 
5034
                                        if (status == MCAPI_SUCCESS)
5035
                                        {
5036
                                            /* Indicate that the send side should be closed. */
5037
                                            status =
5038
                                                MCAPID_TX_Mgmt_Message(mcapi_struct,
5039
                                                                       MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
5040
                                                                       1024, mcapi_struct->local_endp,
5041
                                                                       0, MCAPI_DEFAULT_PRIO);
5042
 
5043
                                            if (status == MCAPI_SUCCESS)
5044
                                            {
5045
                                                /* Wait for a response that the close was successful. */
5046
                                                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5047
                                            }
5048
                                        }
5049
 
5050
                                        /* Close the receive side. */
5051
                                        mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
5052
                                                                      &mcapi_struct->request,
5053
                                                                      &status);
5054
                                    }
5055
                                }
5056
 
5057
                                /* Cancel the second request. */
5058
                                mcapi_cancel(&request2, &status);
5059
                            }
5060
 
5061
                            else
5062
                            {
5063
                                /* Cancel the first request. */
5064
                                mcapi_cancel(&request1, &status);
5065
                            }
5066
                        }
5067
 
5068
                        /* Delete the extra endpoint. */
5069
                        mcapi_delete_endpoint(tx_endp, &status);
5070
 
5071
                    }
5072
 
5073
                    /* Delete the extra endpoint. */
5074
                    mcapi_delete_endpoint(rx_endp, &status);
5075
                }
5076
            }
5077
 
5078
            /* Indicate that the endpoint should be deleted. */
5079
            status =
5080
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
5081
                                       mcapi_struct->local_endp, 0,
5082
                                       MCAPI_DEFAULT_PRIO);
5083
 
5084
            if (status == MCAPI_SUCCESS)
5085
            {
5086
                /* Wait for a response that the endpoint was deleted. */
5087
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5088
            }
5089
        }
5090
    }
5091
 
5092
    /* Set the state of the test to completed. */
5093
    mcapi_struct->state = 0;
5094
 
5095
    /* Allow the next test to run. */
5096
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
5097
 
5098
} /* MCAPI_FTS_Tx_2_35_51 */
5099
 
5100
/************************************************************************
5101
*
5102
*   FUNCTION
5103
*
5104
*       MCAPI_FTS_Tx_2_35_52
5105
*
5106
*   DESCRIPTION
5107
*
5108
*       Testing mcapi_wait_any - Two of the different types, operate on
5109
*       second request – canceled
5110
*
5111
*           Node 1 – Open receive side of packet channel, open send side of
5112
*                    packet channel, cancel second request, wait for
5113
*                    cancellation.
5114
*
5115
*************************************************************************/
5116
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_52)
5117
{
5118
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
5119
    size_t              rx_len;
5120
    mcapi_status_t      status;
5121
    mcapi_boolean_t     finished;
5122
    mcapi_request_t     *req_ptr[2];
5123
    mcapi_request_t     request1;
5124
    mcapi_endpoint_t    rx_endp, tx_endp;
5125
 
5126
    /* Don't let any other test run while this test is running. */
5127
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
5128
 
5129
    /* Two extra endpoints are required for this test. */
5130
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
5131
 
5132
    if (mcapi_struct->status == MCAPI_SUCCESS)
5133
    {
5134
        tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
5135
 
5136
        if (mcapi_struct->status == MCAPI_SUCCESS)
5137
        {
5138
            /* Open the receive side of the packet channel. */
5139
            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle, rx_endp,
5140
                                      &request1, &mcapi_struct->status);
5141
 
5142
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
5143
            {
5144
                /* Open the send side of the packet channel. */
5145
                mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle, tx_endp,
5146
                                          &mcapi_struct->request, &mcapi_struct->status);
5147
 
5148
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
5149
                {
5150
                    /* Indicate that the request should be canceled in 1000 milliseconds. */
5151
                    mcapi_struct->status =
5152
                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_CANCEL_REQUEST, 0,
5153
                                               mcapi_struct->local_endp, 1000,
5154
                                               MCAPI_DEFAULT_PRIO);
5155
 
5156
                    req_ptr[0] = &request1;
5157
                    req_ptr[1] = &mcapi_struct->request;
5158
 
5159
                    /* Wait for the call to timeout. */
5160
                    finished = mcapi_wait_any(2, req_ptr, &rx_len,
5161
                                              MCAPI_FTS_TIMEOUT,
5162
                                              &mcapi_struct->status);
5163
 
5164
                    if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
5165
                         (finished == 1) )
5166
                    {
5167
                        mcapi_struct->status = MCAPI_SUCCESS;
5168
                    }
5169
 
5170
                    else
5171
                    {
5172
                        /* Cancel the second request. */
5173
                        mcapi_cancel(&mcapi_struct->request, &status);
5174
 
5175
                        mcapi_struct->status = -1;
5176
                    }
5177
 
5178
                    /* Wait for a response that the cancel was successful. */
5179
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5180
 
5181
                    /* Cancel the first request. */
5182
                    mcapi_cancel(&request1, &status);
5183
                }
5184
 
5185
                else
5186
                {
5187
                    /* Cancel the first request. */
5188
                    mcapi_cancel(&request1, &status);
5189
                }
5190
            }
5191
 
5192
            /* Delete the extra endpoint. */
5193
            mcapi_delete_endpoint(tx_endp, &status);
5194
        }
5195
 
5196
        /* Delete the extra endpoint. */
5197
        mcapi_delete_endpoint(rx_endp, &status);
5198
    }
5199
 
5200
    /* Set the state of the test to completed. */
5201
    mcapi_struct->state = 0;
5202
 
5203
    /* Allow the next test to run. */
5204
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
5205
 
5206
} /* MCAPI_FTS_Tx_2_35_52 */
5207
 
5208
/************************************************************************
5209
*
5210
*   FUNCTION
5211
*
5212
*       MCAPI_FTS_Tx_2_35_53
5213
*
5214
*   DESCRIPTION
5215
*
5216
*       Testing mcapi_wait_any - Two of the different types, operate on
5217
*       second request – complete
5218
*
5219
*           Node 0 – Wait for get endpoint request, create endpoint
5220
*
5221
*           Node 1 – Issue get endpoint request for a non-existent endpoint
5222
*                    on Node 0, and issue a receive message request, wait
5223
*                    for second request to be complete
5224
*
5225
*************************************************************************/
5226
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_53)
5227
{
5228
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
5229
    size_t              rx_len;
5230
    mcapi_status_t      status;
5231
    mcapi_boolean_t     finished;
5232
    mcapi_request_t     *req_ptr[2];
5233
    mcapi_request_t     request1, request2;
5234
    mcapi_endpoint_t    rx_endp, tx_endp, foreign_rx_endp;
5235
 
5236
    /* Don't let any other test run while this test is running. */
5237
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
5238
 
5239
    /* Indicate that an endpoint should be created. */
5240
    mcapi_struct->status =
5241
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP,
5242
                               1024, mcapi_struct->local_endp, 0,
5243
                               MCAPI_DEFAULT_PRIO);
5244
 
5245
    if (mcapi_struct->status == MCAPI_SUCCESS)
5246
    {
5247
        /* Wait for a response that the endpoint was created. */
5248
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5249
 
5250
        if (mcapi_struct->status == MCAPI_SUCCESS)
5251
        {
5252
            /* Get the foreign endpoint. */
5253
            foreign_rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024,
5254
                                                 &mcapi_struct->status);
5255
 
5256
            if (mcapi_struct->status == MCAPI_SUCCESS)
5257
            {
5258
                /* Two extra endpoints are required for this test. */
5259
                rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
5260
 
5261
                if (mcapi_struct->status == MCAPI_SUCCESS)
5262
                {
5263
                    tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
5264
 
5265
                    if (mcapi_struct->status == MCAPI_SUCCESS)
5266
                    {
5267
                        /* Open the receive side of the packet channel. */
5268
                        mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle, rx_endp,
5269
                                                  &request1, &mcapi_struct->status);
5270
 
5271
                        if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
5272
                        {
5273
                            /* Open the send side of the packet channel. */
5274
                            mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle, tx_endp,
5275
                                                      &request2, &mcapi_struct->status);
5276
 
5277
                            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
5278
                            {
5279
                                /* Issue the connection. */
5280
                                mcapi_connect_pktchan_i(tx_endp, foreign_rx_endp,
5281
                                                        &mcapi_struct->request,
5282
                                                        &mcapi_struct->status);
5283
 
5284
                                if (mcapi_struct->status == MCAPI_SUCCESS)
5285
                                {
5286
                                    /* Wait for the connect to complete. */
5287
                                    mcapi_wait(&mcapi_struct->request, &rx_len,
5288
                                               &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
5289
 
5290
                                    /* Indicate that the receive side should be opened in
5291
                                     * 500 milliseconds.
5292
                                     */
5293
                                    mcapi_struct->status =
5294
                                        MCAPID_TX_Mgmt_Message(mcapi_struct,
5295
                                                               MCAPID_MGMT_OPEN_RX_SIDE_PKT,
5296
                                                               1024, mcapi_struct->local_endp,
5297
                                                               500, MCAPI_DEFAULT_PRIO);
5298
 
5299
                                    req_ptr[0] = &request1;
5300
                                    req_ptr[1] = &request2;
5301
 
5302
                                    /* Wait for the open to complete. */
5303
                                    finished = mcapi_wait_any(2, req_ptr,
5304
                                                              &rx_len,
5305
                                                              MCAPI_FTS_TIMEOUT,
5306
                                                              &mcapi_struct->status);
5307
 
5308
                                    if ( (finished != 1) ||
5309
                                         (mcapi_struct->status != MCAPI_SUCCESS) )
5310
                                    {
5311
                                        /* Cancel the second request. */
5312
                                        mcapi_cancel(&request2, &status);
5313
 
5314
                                        mcapi_struct->status = -1;
5315
                                    }
5316
 
5317
                                    else
5318
                                    {
5319
                                        /* Wait for a response that the open was successful. */
5320
                                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5321
 
5322
                                        if (status == MCAPI_SUCCESS)
5323
                                        {
5324
                                            /* Indicate that the receive side should be closed. */
5325
                                            status =
5326
                                                MCAPID_TX_Mgmt_Message(mcapi_struct,
5327
                                                                       MCAPID_MGMT_CLOSE_RX_SIDE_PKT,
5328
                                                                       1024, mcapi_struct->local_endp,
5329
                                                                       0, MCAPI_DEFAULT_PRIO);
5330
 
5331
                                            if (status == MCAPI_SUCCESS)
5332
                                            {
5333
                                                /* Wait for a response that the close was successful. */
5334
                                                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5335
                                            }
5336
                                        }
5337
 
5338
                                        /* Close the send side. */
5339
                                        mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
5340
                                                                      &mcapi_struct->request,
5341
                                                                      &status);
5342
                                    }
5343
                                }
5344
 
5345
                                /* Cancel the first request. */
5346
                                mcapi_cancel(&request1, &status);
5347
                            }
5348
 
5349
                            else
5350
                            {
5351
                                /* Cancel the first request. */
5352
                                mcapi_cancel(&request1, &status);
5353
                            }
5354
                        }
5355
 
5356
                        /* Delete the extra endpoint. */
5357
                        mcapi_delete_endpoint(tx_endp, &status);
5358
 
5359
                    }
5360
 
5361
                    /* Delete the extra endpoint. */
5362
                    mcapi_delete_endpoint(rx_endp, &status);
5363
                }
5364
            }
5365
 
5366
            /* Indicate that the endpoint should be deleted. */
5367
            status =
5368
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
5369
                                       mcapi_struct->local_endp, 0,
5370
                                       MCAPI_DEFAULT_PRIO);
5371
 
5372
            if (status == MCAPI_SUCCESS)
5373
            {
5374
                /* Wait for a response that the endpoint was deleted. */
5375
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5376
            }
5377
        }
5378
    }
5379
 
5380
    /* Set the state of the test to completed. */
5381
    mcapi_struct->state = 0;
5382
 
5383
    /* Allow the next test to run. */
5384
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
5385
 
5386
} /* MCAPI_FTS_Tx_2_35_53 */
5387
 
5388
/************************************************************************
5389
*
5390
*   FUNCTION
5391
*
5392
*       MCAPI_FTS_Tx_2_35_54
5393
*
5394
*   DESCRIPTION
5395
*
5396
*       Testing mcapi_wait_any - Two of the different types, operate on
5397
*       first request – timeout
5398
*
5399
*           Node 1 – Open receive side of packet channel, open send side
5400
*                    of packet channel, wait for timeout
5401
*
5402
*************************************************************************/
5403
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_54)
5404
{
5405
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
5406
    size_t              rx_len;
5407
    mcapi_status_t      status;
5408
    mcapi_boolean_t     finished;
5409
    mcapi_request_t     *req_ptr[2];
5410
    mcapi_request_t     request1, request2;
5411
    mcapi_endpoint_t    rx_endp1, rx_endp2;
5412
    char                *buffer;
5413
    mcapi_endpoint_t    foreign_tx_endp;
5414
 
5415
    /* Don't let any other test run while this test is running. */
5416
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
5417
 
5418
    /* Indicate that an endpoint should be created. */
5419
    mcapi_struct->status =
5420
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP,
5421
                               1024, mcapi_struct->local_endp, 0,
5422
                               MCAPI_DEFAULT_PRIO);
5423
 
5424
    if (mcapi_struct->status == MCAPI_SUCCESS)
5425
    {
5426
        /* Wait for a response that the endpoint was created. */
5427
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5428
 
5429
        if (mcapi_struct->status == MCAPI_SUCCESS)
5430
        {
5431
            /* Indicate that the foreign endpoint should be opened as the sender. */
5432
            mcapi_struct->status =
5433
                MCAPID_TX_Mgmt_Message(mcapi_struct,
5434
                                       MCAPID_MGMT_OPEN_TX_SIDE_PKT,
5435
                                       1024, mcapi_struct->local_endp,
5436
                                       500, MCAPI_DEFAULT_PRIO);
5437
 
5438
            if (mcapi_struct->status == MCAPI_SUCCESS)
5439
            {
5440
                /* Wait for a response that the endpoint was created. */
5441
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5442
 
5443
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
5444
                {
5445
                    /* Get the foreign endpoint. */
5446
                    foreign_tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024,
5447
                                                         &mcapi_struct->status);
5448
                }
5449
            }
5450
        }
5451
    }
5452
 
5453
    if (mcapi_struct->status == MCAPI_SUCCESS)
5454
    {
5455
        /* Two extra endpoints are required for this test. */
5456
        rx_endp1 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
5457
 
5458
        if (mcapi_struct->status == MCAPI_SUCCESS)
5459
        {
5460
            rx_endp2 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
5461
 
5462
            if (mcapi_struct->status == MCAPI_SUCCESS)
5463
            {
5464
                /* Issue the connection. */
5465
                mcapi_connect_pktchan_i(foreign_tx_endp, rx_endp1,
5466
                                        &mcapi_struct->request,
5467
                                        &mcapi_struct->status);
5468
 
5469
                if (mcapi_struct->status == MCAPI_SUCCESS)
5470
                {
5471
                    /* Wait for the connect to complete. */
5472
                    mcapi_wait(&mcapi_struct->request, &rx_len,
5473
                               &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
5474
 
5475
                    /* Open the receive side of the packet channel. */
5476
                    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
5477
                                              rx_endp1, &mcapi_struct->request,
5478
                                              &mcapi_struct->status);
5479
 
5480
                    if (mcapi_struct->status == MCAPI_SUCCESS)
5481
                    {
5482
                        /* Wait for the open to complete. */
5483
                        mcapi_wait(&mcapi_struct->request, &rx_len,
5484
                                   &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
5485
 
5486
                        /* Issue a receive request. */
5487
                        mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
5488
                                             (void **)&buffer, &request1,
5489
                                             &mcapi_struct->status);
5490
 
5491
                        if (mcapi_struct->status == MCAPI_SUCCESS)
5492
                        {
5493
                            /* Open the receive side of the scalar channel. */
5494
                            mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
5495
                                                      rx_endp2, &request2,
5496
                                                      &mcapi_struct->status);
5497
 
5498
                            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
5499
                            {
5500
                                req_ptr[0] = &request1;
5501
                                req_ptr[1] = &request2;
5502
 
5503
                                /* Wait for the requests to timeout. */
5504
                                finished = mcapi_wait_any(2, req_ptr,
5505
                                                          &rx_len, 250,
5506
                                                          &mcapi_struct->status);
5507
 
5508
                                if (mcapi_struct->status == MCAPI_TIMEOUT)
5509
                                {
5510
                                    mcapi_struct->status = MCAPI_SUCCESS;
5511
                                }
5512
 
5513
                                /* Cancel the second request. */
5514
                                mcapi_cancel(&request2, &status);
5515
                            }
5516
 
5517
                            /* Cancel the first request. */
5518
                            mcapi_cancel(&request1, &status);
5519
 
5520
                            /* Close the receive side. */
5521
                            mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
5522
                                                          &mcapi_struct->request,
5523
                                                          &status);
5524
                        }
5525
                    }
5526
                }
5527
 
5528
                /* Delete the extra endpoint. */
5529
                mcapi_delete_endpoint(rx_endp2, &status);
5530
            }
5531
 
5532
            /* Delete the extra endpoint. */
5533
            mcapi_delete_endpoint(rx_endp1, &status);
5534
        }
5535
    }
5536
 
5537
    /* Indicate that the send side should be closed. */
5538
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
5539
                                    1024, mcapi_struct->local_endp, 0,
5540
                                    MCAPI_DEFAULT_PRIO);
5541
 
5542
    if (status == MCAPI_SUCCESS)
5543
    {
5544
        /* Wait for a response that the close was successful. */
5545
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5546
    }
5547
 
5548
    /* Indicate that the endpoint should be deleted. */
5549
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
5550
                                    mcapi_struct->local_endp, 0,
5551
                                    MCAPI_DEFAULT_PRIO);
5552
 
5553
    if (status == MCAPI_SUCCESS)
5554
    {
5555
        /* Wait for a response that the endpoint was deleted. */
5556
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5557
    }
5558
 
5559
    /* Set the state of the test to completed. */
5560
    mcapi_struct->state = 0;
5561
 
5562
    /* Allow the next test to run. */
5563
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
5564
 
5565
} /* MCAPI_FTS_Tx_2_35_54 */
5566
 
5567
#ifdef LCL_MGMT_UNBROKEN
5568
/************************************************************************
5569
*
5570
*   FUNCTION
5571
*
5572
*       MCAPI_FTS_Tx_2_35_55
5573
*
5574
*   DESCRIPTION
5575
*
5576
*       Testing mcapi_wait_any - Two of the different types, operate on
5577
*       first request – cancel
5578
*
5579
*           Node 1 – Open receive side of packet channel, open send side
5580
*                    of packet channel, wait for cancellation
5581
*
5582
*************************************************************************/
5583
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_55)
5584
{
5585
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
5586
    size_t              rx_len;
5587
    mcapi_status_t      status;
5588
    mcapi_boolean_t     finished;
5589
    mcapi_request_t     *req_ptr[2];
5590
    mcapi_request_t     request2;
5591
    mcapi_endpoint_t    rx_endp1, rx_endp2;
5592
    char                *buffer;
5593
    mcapi_endpoint_t    foreign_tx_endp;
5594
 
5595
    /* Don't let any other test run while this test is running. */
5596
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
5597
 
5598
    /* Set up the structure for getting the local management server. */
5599
    svc_struct.type = MCAPI_MSG_TX_TYPE;
5600
    svc_struct.local_port = MCAPI_PORT_ANY;
5601
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
5602
    svc_struct.service = "lcl_mgmt";
5603
    svc_struct.thread_entry = MCAPI_NULL;
5604
 
5605
    /* Create the client service. */
5606
    MCAPID_Create_Service(&svc_struct);
5607
 
5608
    /* Indicate that an endpoint should be created. */
5609
    mcapi_struct->status =
5610
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP,
5611
                               1024, mcapi_struct->local_endp, 0,
5612
                               MCAPI_DEFAULT_PRIO);
5613
 
5614
    if (mcapi_struct->status == MCAPI_SUCCESS)
5615
    {
5616
        /* Wait for a response that the endpoint was created. */
5617
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5618
 
5619
        if (mcapi_struct->status == MCAPI_SUCCESS)
5620
        {
5621
            /* Indicate that the foreign endpoint should be opened as the sender. */
5622
            mcapi_struct->status =
5623
                MCAPID_TX_Mgmt_Message(mcapi_struct,
5624
                                       MCAPID_MGMT_OPEN_TX_SIDE_PKT, 1024,
5625
                                       mcapi_struct->local_endp, 0,
5626
                                       MCAPI_DEFAULT_PRIO);
5627
 
5628
            if (mcapi_struct->status == MCAPI_SUCCESS)
5629
            {
5630
                /* Wait for a response that the endpoint was created. */
5631
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5632
 
5633
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
5634
                {
5635
                    /* Get the foreign endpoint. */
5636
                    foreign_tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024,
5637
                                                         &mcapi_struct->status);
5638
                }
5639
            }
5640
        }
5641
    }
5642
 
5643
    if (mcapi_struct->status == MCAPI_SUCCESS)
5644
    {
5645
        /* Two extra endpoints are required for this test. */
5646
        rx_endp1 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
5647
 
5648
        if (mcapi_struct->status == MCAPI_SUCCESS)
5649
        {
5650
            rx_endp2 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
5651
 
5652
            if (mcapi_struct->status == MCAPI_SUCCESS)
5653
            {
5654
                /* Issue the connection. */
5655
                mcapi_connect_pktchan_i(foreign_tx_endp, rx_endp1,
5656
                                        &mcapi_struct->request,
5657
                                        &mcapi_struct->status);
5658
 
5659
                if (mcapi_struct->status == MCAPI_SUCCESS)
5660
                {
5661
                    /* Wait for the connect to complete. */
5662
                    mcapi_wait(&mcapi_struct->request, &rx_len,
5663
                               &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
5664
 
5665
                    /* Open the receive side of the packet channel. */
5666
                    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
5667
                                              rx_endp1, &mcapi_struct->request,
5668
                                              &mcapi_struct->status);
5669
 
5670
                    if (mcapi_struct->status == MCAPI_SUCCESS)
5671
                    {
5672
                        /* Wait for the open to complete. */
5673
                        mcapi_wait(&mcapi_struct->request, &rx_len,
5674
                                   &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
5675
 
5676
                        /* Issue a receive request. */
5677
                        mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
5678
                                             (void **)&buffer, &svc_struct.request,
5679
                                             &mcapi_struct->status);
5680
 
5681
                        if (mcapi_struct->status == MCAPI_SUCCESS)
5682
                        {
5683
                            /* Open the receive side of the scalar channel. */
5684
                            mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
5685
                                                      rx_endp2, &request2,
5686
                                                      &mcapi_struct->status);
5687
 
5688
                            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
5689
                            {
5690
                                req_ptr[0] = &svc_struct.request;
5691
                                req_ptr[1] = &request2;
5692
 
5693
                                /* Indicate that the request should be canceled in
5694
                                 * 1000 milliseconds.
5695
                                 */
5696
                                mcapi_struct->status =
5697
                                    MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
5698
                                                           mcapi_struct->local_endp, 1000,
5699
                                                           MCAPI_DEFAULT_PRIO);
5700
 
5701
                                if (mcapi_struct->status == MCAPI_SUCCESS)
5702
                                {
5703
                                    /* Wait for the request to be cancelled. */
5704
                                    finished = mcapi_wait_any(2, req_ptr,
5705
                                                              &rx_len,
5706
                                                              MCAPI_FTS_TIMEOUT,
5707
                                                              &mcapi_struct->status);
5708
 
5709
                                    if ( (finished == 0) &&
5710
                                         (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) )
5711
                                    {
5712
                                        mcapi_struct->status = MCAPI_SUCCESS;
5713
                                    }
5714
 
5715
                                    else
5716
                                    {
5717
                                        /* Cancel the first request. */
5718
                                        mcapi_cancel(&svc_struct.request, &status);
5719
 
5720
                                        mcapi_struct->status = -1;
5721
                                    }
5722
                                }
5723
 
5724
                                /* Cancel the second request. */
5725
                                mcapi_cancel(&request2, &status);
5726
                            }
5727
 
5728
                            else
5729
                            {
5730
                                /* Cancel the first request. */
5731
                                mcapi_cancel(&svc_struct.request, &status);
5732
                            }
5733
 
5734
                            /* Close the receive side. */
5735
                            mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
5736
                                                          &mcapi_struct->request,
5737
                                                          &status);
5738
                        }
5739
                    }
5740
                }
5741
 
5742
                /* Delete the extra endpoint. */
5743
                mcapi_delete_endpoint(rx_endp2, &status);
5744
            }
5745
 
5746
            /* Delete the extra endpoint. */
5747
            mcapi_delete_endpoint(rx_endp1, &status);
5748
        }
5749
    }
5750
 
5751
    /* Indicate that the send side should be closed. */
5752
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
5753
                                    1024, mcapi_struct->local_endp, 0,
5754
                                    MCAPI_DEFAULT_PRIO);
5755
 
5756
    if (status == MCAPI_SUCCESS)
5757
    {
5758
        /* Wait for a response that the close was successful. */
5759
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5760
    }
5761
 
5762
    /* Indicate that the endpoint should be deleted. */
5763
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
5764
                                    mcapi_struct->local_endp, 0,
5765
                                    MCAPI_DEFAULT_PRIO);
5766
 
5767
    if (status == MCAPI_SUCCESS)
5768
    {
5769
        /* Wait for a response that the endpoint was deleted. */
5770
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5771
    }
5772
 
5773
    /* Destroy the client service. */
5774
    MCAPID_Destroy_Service(&svc_struct, 1);
5775
 
5776
    /* Set the state of the test to completed. */
5777
    mcapi_struct->state = 0;
5778
 
5779
    /* Allow the next test to run. */
5780
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
5781
 
5782
} /* MCAPI_FTS_Tx_2_35_55 */
5783
#endif
5784
 
5785
/************************************************************************
5786
*
5787
*   FUNCTION
5788
*
5789
*       MCAPI_FTS_Tx_2_35_56
5790
*
5791
*   DESCRIPTION
5792
*
5793
*       Testing mcapi_wait_any - Two of the different types, operate on
5794
*       first request – complete
5795
*
5796
*           Node 0 - Create endpoint, open send side of packet channel,
5797
*                    send data to other side
5798
*
5799
*           Node 1 – Open receive side of packet channel, open send side
5800
*                    of packet channel, wait for data
5801
*
5802
*************************************************************************/
5803
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_56)
5804
{
5805
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
5806
    size_t              rx_len;
5807
    mcapi_status_t      status;
5808
    mcapi_boolean_t     finished;
5809
    mcapi_request_t     *req_ptr[2];
5810
    mcapi_request_t     request1, request2;
5811
    mcapi_endpoint_t    rx_endp1, rx_endp2;
5812
    char                *buffer;
5813
    mcapi_endpoint_t    foreign_tx_endp;
5814
 
5815
    /* Don't let any other test run while this test is running. */
5816
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
5817
 
5818
    /* Indicate that an endpoint should be created. */
5819
    mcapi_struct->status =
5820
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP,
5821
                               1024, mcapi_struct->local_endp, 0,
5822
                               MCAPI_DEFAULT_PRIO);
5823
 
5824
    if (mcapi_struct->status == MCAPI_SUCCESS)
5825
    {
5826
        /* Wait for a response that the endpoint was created. */
5827
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5828
 
5829
        if (mcapi_struct->status == MCAPI_SUCCESS)
5830
        {
5831
            /* Indicate that the foreign endpoint should be opened as the sender. */
5832
            mcapi_struct->status =
5833
                MCAPID_TX_Mgmt_Message(mcapi_struct,
5834
                                       MCAPID_MGMT_OPEN_TX_SIDE_PKT,
5835
                                       1024, mcapi_struct->local_endp,
5836
                                       0, MCAPI_DEFAULT_PRIO);
5837
 
5838
            if (mcapi_struct->status == MCAPI_SUCCESS)
5839
            {
5840
                /* Wait for a response that the endpoint was created. */
5841
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5842
 
5843
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
5844
                {
5845
                    /* Get the foreign endpoint. */
5846
                    foreign_tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024,
5847
                                                         &mcapi_struct->status);
5848
                }
5849
            }
5850
        }
5851
    }
5852
 
5853
    if (mcapi_struct->status == MCAPI_SUCCESS)
5854
    {
5855
        /* Two extra endpoints are required for this test. */
5856
        rx_endp1 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
5857
 
5858
        if (mcapi_struct->status == MCAPI_SUCCESS)
5859
        {
5860
            rx_endp2 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
5861
 
5862
            if (mcapi_struct->status == MCAPI_SUCCESS)
5863
            {
5864
                /* Issue the connection. */
5865
                mcapi_connect_pktchan_i(foreign_tx_endp, rx_endp1,
5866
                                        &mcapi_struct->request,
5867
                                        &mcapi_struct->status);
5868
 
5869
                if (mcapi_struct->status == MCAPI_SUCCESS)
5870
                {
5871
                    /* Wait for the connect to complete. */
5872
                    mcapi_wait(&mcapi_struct->request, &rx_len,
5873
                               &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
5874
 
5875
                    /* Open the receive side of the packet channel. */
5876
                    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
5877
                                              rx_endp1, &mcapi_struct->request,
5878
                                              &mcapi_struct->status);
5879
 
5880
                    if (mcapi_struct->status == MCAPI_SUCCESS)
5881
                    {
5882
                        /* Wait for the open to complete. */
5883
                        mcapi_wait(&mcapi_struct->request, &rx_len,
5884
                                   &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
5885
 
5886
                        /* Issue a receive request. */
5887
                        mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
5888
                                             (void **)&buffer, &request1,
5889
                                             &mcapi_struct->status);
5890
 
5891
                        if (mcapi_struct->status == MCAPI_SUCCESS)
5892
                        {
5893
                            /* Open the receive side of the scalar channel. */
5894
                            mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
5895
                                                      rx_endp2, &request2,
5896
                                                      &mcapi_struct->status);
5897
 
5898
                            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
5899
                            {
5900
                                req_ptr[0] = &request1;
5901
                                req_ptr[1] = &request2;
5902
 
5903
                                /* Indicate that a packet should be sent. */
5904
                                mcapi_struct->status =
5905
                                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_TX_PKT, 1024,
5906
                                                           mcapi_struct->local_endp, 1000,
5907
                                                           MCAPI_DEFAULT_PRIO);
5908
 
5909
                                if (mcapi_struct->status == MCAPI_SUCCESS)
5910
                                {
5911
                                    /* Wait for the packet. */
5912
                                    finished = mcapi_wait_any(2, req_ptr,
5913
                                                              &rx_len,
5914
                                                              MCAPI_FTS_TIMEOUT,
5915
                                                              &mcapi_struct->status);
5916
 
5917
                                    if ( (finished != 0) ||
5918
                                         (mcapi_struct->status != MCAPI_SUCCESS) )
5919
                                    {
5920
                                        mcapi_struct->status = -1;
5921
 
5922
                                        /* Cancel the first request. */
5923
                                        mcapi_cancel(&request1, &status);
5924
                                    }
5925
 
5926
                                    else
5927
                                    {
5928
                                        /* Free the buffer. */
5929
                                        mcapi_pktchan_free(buffer, &status);
5930
                                    }
5931
                                }
5932
 
5933
                                /* Cancel the second request. */
5934
                                mcapi_cancel(&request2, &status);
5935
                            }
5936
 
5937
                            else
5938
                            {
5939
                                /* Cancel the first request. */
5940
                                mcapi_cancel(&request1, &status);
5941
                            }
5942
 
5943
                            /* Close the receive side. */
5944
                            mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
5945
                                                          &mcapi_struct->request,
5946
                                                          &status);
5947
                        }
5948
                    }
5949
                }
5950
 
5951
                /* Delete the extra endpoint. */
5952
                mcapi_delete_endpoint(rx_endp2, &status);
5953
            }
5954
 
5955
            /* Delete the extra endpoint. */
5956
            mcapi_delete_endpoint(rx_endp1, &status);
5957
        }
5958
    }
5959
 
5960
    /* Indicate that the send side should be closed. */
5961
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
5962
                                    1024, mcapi_struct->local_endp, 0,
5963
                                    MCAPI_DEFAULT_PRIO);
5964
 
5965
    if (status == MCAPI_SUCCESS)
5966
    {
5967
        /* Wait for a response that the close was successful. */
5968
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5969
    }
5970
 
5971
    /* Indicate that the endpoint should be deleted. */
5972
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
5973
                                    mcapi_struct->local_endp, 0,
5974
                                    MCAPI_DEFAULT_PRIO);
5975
 
5976
    if (status == MCAPI_SUCCESS)
5977
    {
5978
        /* Wait for a response that the endpoint was deleted. */
5979
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
5980
    }
5981
 
5982
    /* Set the state of the test to completed. */
5983
    mcapi_struct->state = 0;
5984
 
5985
    /* Allow the next test to run. */
5986
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
5987
 
5988
} /* MCAPI_FTS_Tx_2_35_56 */
5989
 
5990
#ifdef LCL_MGMT_UNBROKEN
5991
/************************************************************************
5992
*
5993
*   FUNCTION
5994
*
5995
*       MCAPI_FTS_Tx_2_35_57
5996
*
5997
*   DESCRIPTION
5998
*
5999
*       Testing mcapi_wait_any - Two of the different types, operate on
6000
*       second request – cancel
6001
*
6002
*           Node 1 – Open receive side of packet channel, open send side
6003
*                    of packet channel, wait for cancellation
6004
*
6005
*************************************************************************/
6006
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_57)
6007
{
6008
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
6009
    size_t              rx_len;
6010
    mcapi_status_t      status;
6011
    mcapi_boolean_t     finished;
6012
    mcapi_request_t     *req_ptr[2];
6013
    mcapi_request_t     request1;
6014
    mcapi_endpoint_t    rx_endp1, rx_endp2;
6015
    char                *buffer;
6016
    mcapi_endpoint_t    foreign_tx_endp;
6017
 
6018
    /* Don't let any other test run while this test is running. */
6019
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
6020
 
6021
    /* Set up the structure for getting the local management server. */
6022
    svc_struct.type = MCAPI_MSG_TX_TYPE;
6023
    svc_struct.local_port = MCAPI_PORT_ANY;
6024
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
6025
    svc_struct.service = "lcl_mgmt";
6026
    svc_struct.thread_entry = MCAPI_NULL;
6027
 
6028
    /* Create the client service. */
6029
    MCAPID_Create_Service(&svc_struct);
6030
 
6031
    /* Indicate that an endpoint should be created. */
6032
    mcapi_struct->status =
6033
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP,
6034
                               1024, mcapi_struct->local_endp, 0,
6035
                               MCAPI_DEFAULT_PRIO);
6036
 
6037
    if (mcapi_struct->status == MCAPI_SUCCESS)
6038
    {
6039
        /* Wait for a response that the endpoint was created. */
6040
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6041
 
6042
        if (mcapi_struct->status == MCAPI_SUCCESS)
6043
        {
6044
            /* Indicate that the foreign endpoint should be opened as the sender. */
6045
            mcapi_struct->status =
6046
                MCAPID_TX_Mgmt_Message(mcapi_struct,
6047
                                       MCAPID_MGMT_OPEN_TX_SIDE_PKT, 1024,
6048
                                       mcapi_struct->local_endp, 0,
6049
                                       MCAPI_DEFAULT_PRIO);
6050
 
6051
            if (mcapi_struct->status == MCAPI_SUCCESS)
6052
            {
6053
                /* Wait for a response that the endpoint was created. */
6054
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6055
 
6056
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
6057
                {
6058
                    /* Get the foreign endpoint. */
6059
                    foreign_tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024,
6060
                                                         &mcapi_struct->status);
6061
                }
6062
            }
6063
        }
6064
    }
6065
 
6066
    if (mcapi_struct->status == MCAPI_SUCCESS)
6067
    {
6068
        /* Two extra endpoints are required for this test. */
6069
        rx_endp1 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
6070
 
6071
        if (mcapi_struct->status == MCAPI_SUCCESS)
6072
        {
6073
            rx_endp2 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
6074
 
6075
            if (mcapi_struct->status == MCAPI_SUCCESS)
6076
            {
6077
                /* Issue the connection. */
6078
                mcapi_connect_pktchan_i(foreign_tx_endp, rx_endp1,
6079
                                        &mcapi_struct->request,
6080
                                        &mcapi_struct->status);
6081
 
6082
                if (mcapi_struct->status == MCAPI_SUCCESS)
6083
                {
6084
                    /* Wait for the connect to complete. */
6085
                    mcapi_wait(&mcapi_struct->request, &rx_len,
6086
                               &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
6087
 
6088
                    /* Open the receive side of the packet channel. */
6089
                    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
6090
                                              rx_endp1, &mcapi_struct->request,
6091
                                              &mcapi_struct->status);
6092
 
6093
                    if (mcapi_struct->status == MCAPI_SUCCESS)
6094
                    {
6095
                        /* Wait for the open to complete. */
6096
                        mcapi_wait(&mcapi_struct->request, &rx_len,
6097
                                   &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
6098
 
6099
                        /* Issue a receive request. */
6100
                        mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
6101
                                             (void **)&buffer, &request1,
6102
                                             &mcapi_struct->status);
6103
 
6104
                        if (mcapi_struct->status == MCAPI_SUCCESS)
6105
                        {
6106
                            /* Open the receive side of the scalar channel. */
6107
                            mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
6108
                                                      rx_endp2, &svc_struct.request,
6109
                                                      &mcapi_struct->status);
6110
 
6111
                            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
6112
                            {
6113
                                req_ptr[0] = &request1;
6114
                                req_ptr[1] = &svc_struct.request;
6115
 
6116
                                /* Indicate that the request should be canceled in
6117
                                 * 1000 milliseconds.
6118
                                 */
6119
                                mcapi_struct->status =
6120
                                    MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
6121
                                                           mcapi_struct->local_endp, 1000,
6122
                                                           MCAPI_DEFAULT_PRIO);
6123
 
6124
                                if (mcapi_struct->status == MCAPI_SUCCESS)
6125
                                {
6126
                                    /* Wait for the request to be cancelled. */
6127
                                    finished = mcapi_wait_any(2, req_ptr,
6128
                                                              &rx_len,
6129
                                                              MCAPI_FTS_TIMEOUT,
6130
                                                              &mcapi_struct->status);
6131
 
6132
                                    if ( (finished == 1) &&
6133
                                         (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) )
6134
                                    {
6135
                                        mcapi_struct->status = MCAPI_SUCCESS;
6136
                                    }
6137
 
6138
                                    else
6139
                                    {
6140
                                        /* Cancel the second request. */
6141
                                        mcapi_cancel(&svc_struct.request, &status);
6142
 
6143
                                        mcapi_struct->status = -1;
6144
                                    }
6145
                                }
6146
                            }
6147
 
6148
                            /* Cancel the first request. */
6149
                            mcapi_cancel(&request1, &status);
6150
 
6151
                            /* Close the receive side. */
6152
                            mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
6153
                                                          &mcapi_struct->request,
6154
                                                          &status);
6155
                        }
6156
                    }
6157
                }
6158
 
6159
                /* Delete the extra endpoint. */
6160
                mcapi_delete_endpoint(rx_endp2, &status);
6161
            }
6162
 
6163
            /* Delete the extra endpoint. */
6164
            mcapi_delete_endpoint(rx_endp1, &status);
6165
        }
6166
    }
6167
 
6168
    /* Indicate that the send side should be closed. */
6169
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
6170
                                    1024, mcapi_struct->local_endp, 0,
6171
                                    MCAPI_DEFAULT_PRIO);
6172
 
6173
    if (status == MCAPI_SUCCESS)
6174
    {
6175
        /* Wait for a response that the close was successful. */
6176
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6177
    }
6178
 
6179
    /* Indicate that the endpoint should be deleted. */
6180
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
6181
                                    mcapi_struct->local_endp, 0,
6182
                                    MCAPI_DEFAULT_PRIO);
6183
 
6184
    if (status == MCAPI_SUCCESS)
6185
    {
6186
        /* Wait for a response that the endpoint was deleted. */
6187
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6188
    }
6189
 
6190
    /* Destroy the client service. */
6191
    MCAPID_Destroy_Service(&svc_struct, 1);
6192
 
6193
    /* Set the state of the test to completed. */
6194
    mcapi_struct->state = 0;
6195
 
6196
    /* Allow the next test to run. */
6197
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
6198
 
6199
} /* MCAPI_FTS_Tx_2_35_57 */
6200
#endif
6201
 
6202
/************************************************************************
6203
*
6204
*   FUNCTION
6205
*
6206
*       MCAPI_FTS_Tx_2_35_58
6207
*
6208
*   DESCRIPTION
6209
*
6210
*       Testing mcapi_wait_any - Two of the different types, operate on
6211
*       second request – complete
6212
*
6213
*           Node 1 – Open receive side of packet channel, open send side
6214
*                    of packet channel, wait for scalar receive side to open
6215
*
6216
*************************************************************************/
6217
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_58)
6218
{
6219
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
6220
    size_t              rx_len;
6221
    mcapi_status_t      status;
6222
    mcapi_boolean_t     finished;
6223
    mcapi_request_t     *req_ptr[2];
6224
    mcapi_request_t     request2, request1;
6225
    mcapi_endpoint_t    rx_endp1, rx_endp2;
6226
    char                *buffer;
6227
    mcapi_endpoint_t    foreign_tx_endp1, foreign_tx_endp2;
6228
 
6229
    /* Don't let any other test run while this test is running. */
6230
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
6231
 
6232
    /* Indicate that an endpoint should be created. */
6233
    mcapi_struct->status =
6234
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP,
6235
                               1024, mcapi_struct->local_endp, 0,
6236
                               MCAPI_DEFAULT_PRIO);
6237
 
6238
    if (mcapi_struct->status == MCAPI_SUCCESS)
6239
    {
6240
        /* Wait for a response that the endpoint was created. */
6241
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6242
 
6243
        if (mcapi_struct->status == MCAPI_SUCCESS)
6244
        {
6245
            /* Indicate that the foreign endpoint should be opened as the sender. */
6246
            mcapi_struct->status =
6247
                MCAPID_TX_Mgmt_Message(mcapi_struct,
6248
                                       MCAPID_MGMT_OPEN_TX_SIDE_PKT,
6249
                                       1024, mcapi_struct->local_endp,
6250
                                       0, MCAPI_DEFAULT_PRIO);
6251
 
6252
            if (mcapi_struct->status == MCAPI_SUCCESS)
6253
            {
6254
                /* Wait for a response that the endpoint was created. */
6255
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6256
 
6257
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
6258
                {
6259
                    /* Get the foreign endpoint. */
6260
                    foreign_tx_endp1 = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024,
6261
                                                          &mcapi_struct->status);
6262
 
6263
                    if (mcapi_struct->status == MCAPI_SUCCESS)
6264
                    {
6265
                        /* Indicate that an endpoint should be created. */
6266
                        mcapi_struct->status =
6267
                            MCAPID_TX_Mgmt_Message(mcapi_struct,
6268
                                                   MCAPID_MGMT_CREATE_ENDP, 1025,
6269
                                                   mcapi_struct->local_endp, 0,
6270
                                                   MCAPI_DEFAULT_PRIO);
6271
 
6272
                        if (mcapi_struct->status == MCAPI_SUCCESS)
6273
                        {
6274
                            /* Wait for a response that the endpoint was created. */
6275
                            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6276
 
6277
                            if (mcapi_struct->status == MCAPI_SUCCESS)
6278
                            {
6279
                                /* Get the second foreign endpoint. */
6280
                                foreign_tx_endp2 = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID,
6281
                                                                      1025,
6282
                                                                      &mcapi_struct->status);
6283
                            }
6284
                        }
6285
                    }
6286
                }
6287
            }
6288
        }
6289
    }
6290
 
6291
    if (mcapi_struct->status == MCAPI_SUCCESS)
6292
    {
6293
        /* Two extra endpoints are required for this test. */
6294
        rx_endp1 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
6295
 
6296
        if (mcapi_struct->status == MCAPI_SUCCESS)
6297
        {
6298
            rx_endp2 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
6299
 
6300
            if (mcapi_struct->status == MCAPI_SUCCESS)
6301
            {
6302
                /* Issue the packet connection. */
6303
                mcapi_connect_pktchan_i(foreign_tx_endp1, rx_endp1,
6304
                                        &mcapi_struct->request,
6305
                                        &mcapi_struct->status);
6306
 
6307
                if (mcapi_struct->status == MCAPI_SUCCESS)
6308
                {
6309
                    /* Wait for the connect to complete. */
6310
                    mcapi_wait(&mcapi_struct->request, &rx_len,
6311
                               &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
6312
 
6313
                    /* Open the receive side of the packet channel. */
6314
                    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
6315
                                              rx_endp1, &mcapi_struct->request,
6316
                                              &mcapi_struct->status);
6317
 
6318
                    if (mcapi_struct->status == MCAPI_SUCCESS)
6319
                    {
6320
                        /* Wait for the open to complete. */
6321
                        mcapi_wait(&mcapi_struct->request, &rx_len,
6322
                                   &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
6323
 
6324
                        /* Issue a receive request. */
6325
                        mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
6326
                                             (void **)&buffer, &request1,
6327
                                             &mcapi_struct->status);
6328
 
6329
                        if (mcapi_struct->status == MCAPI_SUCCESS)
6330
                        {
6331
                            /* Open the receive side of the scalar channel. */
6332
                            mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
6333
                                                      rx_endp2, &request2,
6334
                                                      &mcapi_struct->status);
6335
 
6336
                            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
6337
                            {
6338
                                /* Issue the scalar connection. */
6339
                                mcapi_connect_sclchan_i(foreign_tx_endp2, rx_endp2,
6340
                                                        &mcapi_struct->request,
6341
                                                        &mcapi_struct->status);
6342
 
6343
                                if (mcapi_struct->status == MCAPI_SUCCESS)
6344
                                {
6345
                                    /* Wait for the connect to complete. */
6346
                                    mcapi_wait(&mcapi_struct->request, &rx_len,
6347
                                               &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
6348
 
6349
                                    /* Indicate that the foreign endpoint should be opened
6350
                                     * as the sender in 500 milliseconds.
6351
                                     */
6352
                                    mcapi_struct->status =
6353
                                        MCAPID_TX_Mgmt_Message(mcapi_struct,
6354
                                                               MCAPID_MGMT_OPEN_TX_SIDE_SCL,
6355
                                                               1025, mcapi_struct->local_endp,
6356
                                                               500, MCAPI_DEFAULT_PRIO);
6357
 
6358
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
6359
                                    {
6360
                                        req_ptr[0] = &request1;
6361
                                        req_ptr[1] = &request2;
6362
 
6363
                                        /* Wait for the request to be complete. */
6364
                                        finished = mcapi_wait_any(2, req_ptr,
6365
                                                                  &rx_len,
6366
                                                                  MCAPI_FTS_TIMEOUT,
6367
                                                                  &mcapi_struct->status);
6368
 
6369
                                        if ( (finished != 1) ||
6370
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
6371
                                        {
6372
                                            mcapi_struct->status = -1;
6373
                                        }
6374
                                    }
6375
                                }
6376
 
6377
                                /* Close the receive side of the scalar channel. */
6378
                                mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
6379
                                                           &mcapi_struct->request,
6380
                                                           &status);
6381
                            }
6382
 
6383
                            /* Cancel the first request. */
6384
                            mcapi_cancel(&request1, &status);
6385
                        }
6386
 
6387
                        /* Close the receive side of the packet channel. */
6388
                        mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
6389
                                                      &mcapi_struct->request,
6390
                                                      &status);
6391
                    }
6392
                }
6393
 
6394
                /* Delete the extra endpoint. */
6395
                mcapi_delete_endpoint(rx_endp2, &status);
6396
            }
6397
 
6398
            /* Delete the extra endpoint. */
6399
            mcapi_delete_endpoint(rx_endp1, &status);
6400
        }
6401
    }
6402
 
6403
    /* Indicate that the send side should be closed. */
6404
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
6405
                                    1024, mcapi_struct->local_endp, 0,
6406
                                    MCAPI_DEFAULT_PRIO);
6407
 
6408
    if (status == MCAPI_SUCCESS)
6409
    {
6410
        /* Wait for a response that the close was successful. */
6411
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6412
    }
6413
 
6414
    /* Indicate that the endpoint should be deleted. */
6415
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
6416
                                    mcapi_struct->local_endp, 0,
6417
                                    MCAPI_DEFAULT_PRIO);
6418
 
6419
    if (status == MCAPI_SUCCESS)
6420
    {
6421
        /* Wait for a response that the endpoint was deleted. */
6422
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6423
    }
6424
 
6425
    /* Indicate that the send side should be closed. */
6426
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
6427
                                    1025, mcapi_struct->local_endp, 0,
6428
                                    MCAPI_DEFAULT_PRIO);
6429
 
6430
    if (status == MCAPI_SUCCESS)
6431
    {
6432
        /* Wait for a response that the close was successful. */
6433
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6434
    }
6435
 
6436
    /* Indicate that the endpoint should be deleted. */
6437
    status = MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1025,
6438
                                    mcapi_struct->local_endp, 0,
6439
                                    MCAPI_DEFAULT_PRIO);
6440
 
6441
    if (status == MCAPI_SUCCESS)
6442
    {
6443
        /* Wait for a response that the endpoint was deleted. */
6444
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6445
    }
6446
 
6447
    /* Set the state of the test to completed. */
6448
    mcapi_struct->state = 0;
6449
 
6450
    /* Allow the next test to run. */
6451
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
6452
 
6453
} /* MCAPI_FTS_Tx_2_35_58 */
6454
 
6455
/************************************************************************
6456
*
6457
*   FUNCTION
6458
*
6459
*       MCAPI_FTS_Tx_2_35_59
6460
*
6461
*   DESCRIPTION
6462
*
6463
*       Testing mcapi_wait_any - Two of the different types, operate on
6464
*       first request – timeout
6465
*
6466
*           Node 1 – Make a call to open the send side of a scalar channel,
6467
*                    get non-existent endpoint on Node 0, wait for timeout
6468
*
6469
*************************************************************************/
6470
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_59)
6471
{
6472
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
6473
    mcapi_endpoint_t    endpoint;
6474
    size_t              rx_len;
6475
    mcapi_status_t      status;
6476
    mcapi_boolean_t     finished;
6477
    mcapi_request_t     *req_ptr[2];
6478
    mcapi_request_t     request1, request2;
6479
 
6480
    /* Don't let any other test run while this test is running. */
6481
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
6482
 
6483
    /* Open the send side of a scalar channel. */
6484
    mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
6485
                              mcapi_struct->local_endp, &request1,
6486
                              &mcapi_struct->status);
6487
 
6488
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
6489
    {
6490
        /* Get a foreign endpoint. */
6491
        mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
6492
                             &request2, &mcapi_struct->status);
6493
 
6494
        if (mcapi_struct->status == MCAPI_SUCCESS)
6495
        {
6496
            req_ptr[0] = &request1;
6497
            req_ptr[1] = &request2;
6498
 
6499
            /* Wait for the call to timeout. */
6500
            finished = mcapi_wait_any(2, req_ptr, &rx_len, 250,
6501
                                      &mcapi_struct->status);
6502
 
6503
            if (mcapi_struct->status == MCAPI_TIMEOUT)
6504
            {
6505
                mcapi_struct->status = MCAPI_SUCCESS;
6506
            }
6507
 
6508
            else
6509
            {
6510
                mcapi_struct->status = -1;
6511
            }
6512
 
6513
            /* Cancel the second request. */
6514
            mcapi_cancel(&request2, &status);
6515
        }
6516
 
6517
        /* Cancel the first request. */
6518
        mcapi_cancel(&request1, &status);
6519
    }
6520
 
6521
    /* Set the state of the test to completed. */
6522
    mcapi_struct->state = 0;
6523
 
6524
    /* Allow the next test to run. */
6525
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
6526
 
6527
} /* MCAPI_FTS_Tx_2_35_59 */
6528
 
6529
/************************************************************************
6530
*
6531
*   FUNCTION
6532
*
6533
*       MCAPI_FTS_Tx_2_35_60
6534
*
6535
*   DESCRIPTION
6536
*
6537
*       Testing mcapi_wait_any - Two of the different types, operate on
6538
*       first request – canceled
6539
*
6540
*           Node 1 – Make a call to open the send side of a scalar channel,
6541
*                    get non-existent endpoint on Node 0, wait for
6542
*                    cancellation
6543
*
6544
*************************************************************************/
6545
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_60)
6546
{
6547
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
6548
    mcapi_endpoint_t    endpoint = 0xffffffff, tx_endp;
6549
    size_t              rx_len;
6550
    mcapi_status_t      status;
6551
    mcapi_boolean_t     finished;
6552
    mcapi_request_t     *req_ptr[2];
6553
    mcapi_request_t     request2;
6554
 
6555
    /* Don't let any other test run while this test is running. */
6556
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
6557
 
6558
    /* An extra endpoint is required for this test. */
6559
    tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
6560
 
6561
    if (mcapi_struct->status == MCAPI_SUCCESS)
6562
    {
6563
        /* Open the send side of a scalar channel. */
6564
        mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
6565
                                  tx_endp, &mcapi_struct->request,
6566
                                  &mcapi_struct->status);
6567
 
6568
        if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
6569
        {
6570
            /* Get a foreign endpoint. */
6571
            mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1025, &endpoint,
6572
                                 &request2, &mcapi_struct->status);
6573
 
6574
            if (mcapi_struct->status == MCAPI_SUCCESS)
6575
            {
6576
                /* Indicate that the request should be canceled in 1000 milliseconds. */
6577
                mcapi_struct->status =
6578
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_CANCEL_REQUEST, 0,
6579
                                           mcapi_struct->local_endp, 1000,
6580
                                           MCAPI_DEFAULT_PRIO);
6581
 
6582
                req_ptr[0] = &mcapi_struct->request;
6583
                req_ptr[1] = &request2;
6584
 
6585
                /* Wait for the request to be canceled. */
6586
                finished = mcapi_wait_any(2, req_ptr, &rx_len,
6587
                                          MCAPI_FTS_TIMEOUT,
6588
                                          &mcapi_struct->status);
6589
 
6590
                if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
6591
                     (finished == 0) )
6592
                {
6593
                    mcapi_struct->status = MCAPI_SUCCESS;
6594
                }
6595
 
6596
                else
6597
                {
6598
                    /* Cancel the first request. */
6599
                    mcapi_cancel(&mcapi_struct->request, &status);
6600
 
6601
                    mcapi_struct->status = -1;
6602
                }
6603
 
6604
                /* Cancel the second request. */
6605
                mcapi_cancel(&request2, &status);
6606
            }
6607
 
6608
            else
6609
            {
6610
                /* Cancel the first request. */
6611
                mcapi_cancel(&mcapi_struct->request, &status);
6612
            }
6613
 
6614
            /* Wait for a response that the cancel was successful. */
6615
            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6616
        }
6617
 
6618
        /* Delete the extra endpoint. */
6619
        mcapi_delete_endpoint(tx_endp, &status);
6620
    }
6621
 
6622
    /* Set the state of the test to completed. */
6623
    mcapi_struct->state = 0;
6624
 
6625
    /* Allow the next test to run. */
6626
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
6627
 
6628
} /* MCAPI_FTS_Tx_2_35_60 */
6629
 
6630
/************************************************************************
6631
*
6632
*   FUNCTION
6633
*
6634
*       MCAPI_FTS_Tx_2_35_61
6635
*
6636
*   DESCRIPTION
6637
*
6638
*       Testing mcapi_wait_any - Two of the same types, operate on
6639
*       first request – complete
6640
*
6641
*           Node 0 – Wait for get endpoint request, create endpoint
6642
*
6643
*           Node 1 – Issue get endpoint request for non-existent endpoint
6644
*                    on Node 0, wait for completion
6645
*
6646
*************************************************************************/
6647
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_61)
6648
{
6649
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
6650
    mcapi_endpoint_t    endpoint = 0xffffffff, tx_endp, foreign_rx_endp;
6651
    size_t              rx_len;
6652
    mcapi_status_t      status;
6653
    mcapi_boolean_t     finished;
6654
    mcapi_request_t     *req_ptr[2];
6655
    mcapi_request_t     request1, request2;
6656
 
6657
    /* Don't let any other test run while this test is running. */
6658
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
6659
 
6660
    /* Indicate that an endpoint should be created. */
6661
    mcapi_struct->status =
6662
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP,
6663
                               1024, mcapi_struct->local_endp, 0,
6664
                               MCAPI_DEFAULT_PRIO);
6665
 
6666
    if (mcapi_struct->status == MCAPI_SUCCESS)
6667
    {
6668
        /* Wait for a response that the endpoint was created. */
6669
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6670
 
6671
        if (mcapi_struct->status == MCAPI_SUCCESS)
6672
        {
6673
            /* Get the foreign endpoint. */
6674
            foreign_rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024,
6675
                                                 &mcapi_struct->status);
6676
 
6677
            if (mcapi_struct->status == MCAPI_SUCCESS)
6678
            {
6679
                /* An extra endpoint is required for this test. */
6680
                tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
6681
 
6682
                if (mcapi_struct->status == MCAPI_SUCCESS)
6683
                {
6684
                    /* Connect the two endpoints. */
6685
                    mcapi_connect_sclchan_i(tx_endp, foreign_rx_endp,
6686
                                            &mcapi_struct->request,
6687
                                            &mcapi_struct->status);
6688
 
6689
                    if (mcapi_struct->status == MCAPI_SUCCESS)
6690
                    {
6691
                        /* Wait for the connection to open. */
6692
                        mcapi_wait(&mcapi_struct->request, &rx_len,
6693
                                   &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
6694
 
6695
                        /* Open the send side of a scalar channel. */
6696
                        mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
6697
                                                  tx_endp, &request1,
6698
                                                  &mcapi_struct->status);
6699
 
6700
                        if (mcapi_struct->status == MCAPI_SUCCESS)
6701
                        {
6702
                            /* Get a foreign endpoint. */
6703
                            mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1025, &endpoint,
6704
                                                 &request2, &mcapi_struct->status);
6705
 
6706
                            if (mcapi_struct->status == MCAPI_SUCCESS)
6707
                            {
6708
                                /* Indicate that the foreign endpoint should be opened
6709
                                 * as the receiver.
6710
                                 */
6711
                                mcapi_struct->status =
6712
                                    MCAPID_TX_Mgmt_Message(mcapi_struct,
6713
                                                           MCAPID_MGMT_OPEN_RX_SIDE_SCL,
6714
                                                           1024, mcapi_struct->local_endp,
6715
                                                           500, MCAPI_DEFAULT_PRIO);
6716
 
6717
                                if (mcapi_struct->status == MCAPI_SUCCESS)
6718
                                {
6719
                                    req_ptr[0] = &request1;
6720
                                    req_ptr[1] = &request2;
6721
 
6722
                                    /* Wait for the call to complete. */
6723
                                    finished = mcapi_wait_any(2, req_ptr,
6724
                                                              &rx_len,
6725
                                                              MCAPI_FTS_TIMEOUT,
6726
                                                              &mcapi_struct->status);
6727
 
6728
                                    if ( (finished != 0) ||
6729
                                         (mcapi_struct->status != MCAPI_SUCCESS) )
6730
                                    {
6731
                                        /* Cancel the first request. */
6732
                                        mcapi_cancel(&request1, &status);
6733
 
6734
                                        mcapi_struct->status = -1;
6735
                                    }
6736
 
6737
                                    /* Wait for a response that the open was successful. */
6738
                                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6739
                                }
6740
 
6741
                                /* Cancel the second request. */
6742
                                mcapi_cancel(&request2, &status);
6743
 
6744
                                /* Indicate that the receive side should be closed. */
6745
                                status = MCAPID_TX_Mgmt_Message(mcapi_struct,
6746
                                                                MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
6747
                                                                1024, mcapi_struct->local_endp,
6748
                                                                0, MCAPI_DEFAULT_PRIO);
6749
 
6750
                                if (status == MCAPI_SUCCESS)
6751
                                {
6752
                                    /* Wait for a response that the close was successful. */
6753
                                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6754
                                }
6755
                            }
6756
 
6757
                            else
6758
                            {
6759
                                /* Cancel the first request. */
6760
                                mcapi_cancel(&request1, &status);
6761
                            }
6762
 
6763
                            /* Close the send side of the scalar channel. */
6764
                            mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
6765
                                                       &mcapi_struct->request,
6766
                                                       &status);
6767
                        }
6768
                    }
6769
 
6770
                    /* Delete the extra endpoint. */
6771
                    mcapi_delete_endpoint(tx_endp, &status);
6772
                }
6773
            }
6774
 
6775
            /* Indicate that the endpoint should be deleted. */
6776
            status =
6777
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
6778
                                       mcapi_struct->local_endp, 0,
6779
                                       MCAPI_DEFAULT_PRIO);
6780
 
6781
            if (status == MCAPI_SUCCESS)
6782
            {
6783
                /* Wait for a response that the endpoint was deleted. */
6784
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6785
            }
6786
        }
6787
    }
6788
 
6789
    /* Set the state of the test to completed. */
6790
    mcapi_struct->state = 0;
6791
 
6792
    /* Allow the next test to run. */
6793
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
6794
 
6795
} /* MCAPI_FTS_Tx_2_35_61 */
6796
 
6797
/************************************************************************
6798
*
6799
*   FUNCTION
6800
*
6801
*       MCAPI_FTS_Tx_2_35_62
6802
*
6803
*   DESCRIPTION
6804
*
6805
*       Testing mcapi_wait_any while getting two of different type, operate
6806
*       on second request - canceled
6807
*
6808
*           Node 1 – Make a call to open the send side of a scalar channel,
6809
*                    get non-existent endpoint on Node 0, wait for
6810
*                    cancellation
6811
*
6812
*************************************************************************/
6813
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_62)
6814
{
6815
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
6816
    mcapi_endpoint_t    endpoint, tx_endp;
6817
    size_t              rx_len;
6818
    mcapi_status_t      status;
6819
    mcapi_boolean_t     finished;
6820
    mcapi_request_t     *req_ptr[2];
6821
    mcapi_request_t     request1;
6822
 
6823
    /* Don't let any other test run while this test is running. */
6824
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
6825
 
6826
    /* An additional endpoint is required for this test. */
6827
    tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
6828
 
6829
    if (mcapi_struct->status == MCAPI_SUCCESS)
6830
    {
6831
        /* Open the send side of a scalar channel. */
6832
        mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
6833
                                  tx_endp, &request1, &mcapi_struct->status);
6834
 
6835
        if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
6836
        {
6837
            /* Get a foreign endpoint. */
6838
            mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
6839
                                 &mcapi_struct->request, &mcapi_struct->status);
6840
 
6841
            if (mcapi_struct->status == MCAPI_SUCCESS)
6842
            {
6843
                /* Indicate that the request should be canceled in 1000 milliseconds. */
6844
                mcapi_struct->status =
6845
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_CANCEL_REQUEST, 0,
6846
                                           mcapi_struct->local_endp, 1000,
6847
                                           MCAPI_DEFAULT_PRIO);
6848
 
6849
                req_ptr[0] = &request1;
6850
                req_ptr[1] = &mcapi_struct->request;
6851
 
6852
                /* Wait for the call to timeout. */
6853
                finished = mcapi_wait_any(2, req_ptr, &rx_len,
6854
                                          MCAPI_FTS_TIMEOUT,
6855
                                          &mcapi_struct->status);
6856
 
6857
                if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
6858
                     (finished == 1) )
6859
                {
6860
                    mcapi_struct->status = MCAPI_SUCCESS;
6861
                }
6862
 
6863
                else
6864
                {
6865
                    /* Cancel the second request. */
6866
                    mcapi_cancel(&mcapi_struct->request, &status);
6867
 
6868
                    mcapi_struct->status = -1;
6869
                }
6870
 
6871
                /* Cancel the first request. */
6872
                mcapi_cancel(&request1, &status);
6873
            }
6874
 
6875
            else
6876
            {
6877
                /* Cancel the first request. */
6878
                mcapi_cancel(&mcapi_struct->request, &status);
6879
            }
6880
 
6881
            /* Wait for a response that the cancel was successful. */
6882
            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6883
        }
6884
 
6885
        /* Delete the extra endpoint. */
6886
        mcapi_delete_endpoint(tx_endp, &status);
6887
    }
6888
 
6889
    /* Set the state of the test to completed. */
6890
    mcapi_struct->state = 0;
6891
 
6892
    /* Allow the next test to run. */
6893
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
6894
 
6895
} /* MCAPI_FTS_Tx_2_35_62 */
6896
 
6897
/************************************************************************
6898
*
6899
*   FUNCTION
6900
*
6901
*       MCAPI_FTS_Tx_2_35_63
6902
*
6903
*   DESCRIPTION
6904
*
6905
*       Testing mcapi_wait_any - Two of the different types, operate on
6906
*       second request – complete
6907
*
6908
*           Node 0 – Wait for get endpoint requests, create endpoint
6909
*
6910
*           Node 1 – Make a call to open the send side of a scalar channel,
6911
*                    get non-existent endpoint on Node 0, wait for get
6912
*                    endpoint to complete
6913
*
6914
*************************************************************************/
6915
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_63)
6916
{
6917
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
6918
    mcapi_endpoint_t    endpoint, tx_endp;
6919
    size_t              rx_len;
6920
    mcapi_status_t      status;
6921
    mcapi_boolean_t     finished;
6922
    mcapi_request_t     *req_ptr[2];
6923
    mcapi_request_t     request1, request2;
6924
 
6925
    /* Don't let any other test run while this test is running. */
6926
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
6927
 
6928
    /* An additional endpoint is required for this test. */
6929
    tx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
6930
 
6931
    if (mcapi_struct->status == MCAPI_SUCCESS)
6932
    {
6933
        /* Open the send side of a scalar channel. */
6934
        mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
6935
                                  tx_endp, &request1, &mcapi_struct->status);
6936
 
6937
        if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
6938
        {
6939
            /* Get a foreign endpoint. */
6940
            mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1025, &endpoint,
6941
                                 &request2, &mcapi_struct->status);
6942
 
6943
            if (mcapi_struct->status == MCAPI_SUCCESS)
6944
            {
6945
                /* Indicate that the endpoint should be created in 500 milliseconds. */
6946
                mcapi_struct->status =
6947
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1025,
6948
                                           mcapi_struct->local_endp, 500,
6949
                                           MCAPI_DEFAULT_PRIO);
6950
 
6951
                req_ptr[0] = &request1;
6952
                req_ptr[1] = &request2;
6953
 
6954
                /* Wait for the call to timeout. */
6955
                finished = mcapi_wait_any(2, req_ptr, &rx_len,
6956
                                          MCAPI_FTS_TIMEOUT,
6957
                                          &mcapi_struct->status);
6958
 
6959
                if ( (finished != 1) ||
6960
                     (mcapi_struct->status != MCAPI_SUCCESS) )
6961
                {
6962
                    /* Cancel the second request. */
6963
                    mcapi_cancel(&request2, &status);
6964
 
6965
                    mcapi_struct->status = -1;
6966
                }
6967
 
6968
                /* Wait for a response that the creation was successful. */
6969
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6970
                status_assert(status);
6971
 
6972
                /* Indicate that the endpoint should be deleted. */
6973
                status =
6974
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1025,
6975
                                           mcapi_struct->local_endp, 0,
6976
                                           MCAPI_DEFAULT_PRIO);
6977
                status_assert(status);
6978
 
6979
                /* Wait for a response that the endpoint was deleted. */
6980
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
6981
                status_assert(status);
6982
 
6983
                /* Cancel the first request. */
6984
                mcapi_cancel(&request1, &status);
6985
            }
6986
 
6987
            else
6988
            {
6989
                /* Cancel the first request. */
6990
                mcapi_cancel(&request1, &status);
6991
            }
6992
        }
6993
 
6994
        /* Delete the extra endpoint. */
6995
        mcapi_delete_endpoint(tx_endp, &status);
6996
    }
6997
 
6998
    /* Set the state of the test to completed. */
6999
    mcapi_struct->state = 0;
7000
 
7001
    /* Allow the next test to run. */
7002
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
7003
 
7004
} /* MCAPI_FTS_Tx_2_35_63 */
7005
 
7006
/************************************************************************
7007
*
7008
*   FUNCTION
7009
*
7010
*       MCAPI_FTS_Tx_2_35_64
7011
*
7012
*   DESCRIPTION
7013
*
7014
*       Testing mcapi_wait_any - one of each type – timeout
7015
*
7016
*           Node 1 – Get foreign endpoint, issue call to receive message,
7017
*                    open receive side of packet channel, open send side
7018
*                    of packet channel, make call to receive data on packet
7019
*                    channel, open receive side of scalar channel, open
7020
*                    send side of scalar channel – wait for timeout
7021
*
7022
*************************************************************************/
7023
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_64)
7024
{
7025
    MCAPID_STRUCT               *mcapi_struct = (MCAPID_STRUCT*)argv;
7026
    mcapi_endpoint_t            endpoint, rx_endp1, rx_endp2, rx_endp3,
7027
                                rx_endp4, tx_endp1, tx_endp2, foreign_tx_endp1;
7028
    size_t                      rx_len;
7029
    mcapi_status_t              status;
7030
    mcapi_boolean_t             finished;
7031
    mcapi_request_t             *req_ptr[7];
7032
    mcapi_request_t             request1, request2, request3, request4,
7033
                                request5, request6, request7;
7034
    mcapi_pktchan_recv_hndl_t   rx_handle;
7035
    char                        *pkt_ptr;
7036
    char                        buffer[MCAPID_MSG_LEN];
7037
    int                         i;
7038
 
7039
    /* Don't let any other test run while this test is running. */
7040
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
7041
 
7042
    /* Get a foreign endpoint. */
7043
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
7044
                         &request1, &mcapi_struct->status);
7045
    status_assert(mcapi_struct->status);
7046
 
7047
    /* Create an endpoint for receiving messages. */
7048
    rx_endp1 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7049
    status_assert(mcapi_struct->status);
7050
 
7051
    /* Make the call to receive data on this endpoint. */
7052
    mcapi_msg_recv_i(rx_endp1, buffer, MCAPID_MSG_LEN, &request2,
7053
                     &mcapi_struct->status);
7054
    status_assert(mcapi_struct->status);
7055
 
7056
    /* Create an endpoint for the receive side of a packet channel. */
7057
    rx_endp2 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7058
    status_assert(mcapi_struct->status);
7059
 
7060
    /* Open receive side of a packet channel. */
7061
    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
7062
                              rx_endp2, &request3, &mcapi_struct->status);
7063
    status_assert_code(mcapi_struct->status, MGC_MCAPI_ERR_NOT_CONNECTED);
7064
 
7065
    /* Create an endpoint for the send side of a packet channel. */
7066
    tx_endp1 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7067
    status_assert(mcapi_struct->status);
7068
 
7069
    /* Open send side of a packet channel. */
7070
    mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
7071
                              tx_endp1, &request4, &mcapi_struct->status);
7072
    status_assert_code(mcapi_struct->status, MGC_MCAPI_ERR_NOT_CONNECTED);
7073
 
7074
    /* Indicate that an endpoint should be created. */
7075
    mcapi_struct->status =
7076
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1025,
7077
                               mcapi_struct->local_endp, 0,
7078
                               MCAPI_DEFAULT_PRIO);
7079
    status_assert(mcapi_struct->status);
7080
 
7081
    /* Wait for a response. */
7082
    mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7083
    status_assert(mcapi_struct->status);
7084
 
7085
    /* Indicate that the send side should be opened. */
7086
    mcapi_struct->status =
7087
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT, 1025,
7088
                               mcapi_struct->local_endp, 0,
7089
                               MCAPI_DEFAULT_PRIO);
7090
    status_assert(mcapi_struct->status);
7091
 
7092
    /* Wait for a response. */
7093
    mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7094
    status_assert_code(mcapi_struct->status, MGC_MCAPI_ERR_NOT_CONNECTED);
7095
 
7096
    /* Get the foreign endpoint. */
7097
    foreign_tx_endp1 = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1025,
7098
                                          &mcapi_struct->status);
7099
    status_assert(mcapi_struct->status);
7100
 
7101
    /* Create an endpoint for the receive side of a packet channel. */
7102
    rx_endp3 =
7103
        mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7104
    status_assert(mcapi_struct->status);
7105
 
7106
    /* Connect the two endpoints. */
7107
    mcapi_connect_pktchan_i(foreign_tx_endp1, rx_endp3,
7108
                            &mcapi_struct->request,
7109
                            &mcapi_struct->status);
7110
    status_assert(mcapi_struct->status);
7111
 
7112
    /* Wait for the connection. */
7113
    mcapi_wait(&mcapi_struct->request, &rx_len,
7114
               &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
7115
 
7116
    /* Open receive side of a packet channel. */
7117
    mcapi_open_pktchan_recv_i(&rx_handle, rx_endp3,
7118
                              &mcapi_struct->request,
7119
                              &mcapi_struct->status);
7120
    status_assert(mcapi_struct->status);
7121
 
7122
    /* Wait for the open. */
7123
    mcapi_wait(&mcapi_struct->request, &rx_len,
7124
               &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
7125
 
7126
    /* Wait for data on the channel. */
7127
    mcapi_pktchan_recv_i(rx_handle, (void**)&pkt_ptr, &request5,
7128
                         &mcapi_struct->status);
7129
    status_assert(mcapi_struct->status);
7130
 
7131
    /* Create an endpoint for the receive side of a scalar channel. */
7132
    rx_endp4 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7133
    status_assert(mcapi_struct->status);
7134
 
7135
    /* Open receive side of a scalar channel. */
7136
    mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
7137
                              rx_endp4, &request6, &mcapi_struct->status);
7138
    status_assert_code(mcapi_struct->status, MGC_MCAPI_ERR_NOT_CONNECTED);
7139
 
7140
    /* Create an endpoint for the send side of a scalar channel. */
7141
    tx_endp2 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7142
    status_assert(mcapi_struct->status);
7143
 
7144
    /* Open send side of a scalar channel. */
7145
    mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
7146
                              tx_endp2, &request7, &mcapi_struct->status);
7147
    status_assert_code(mcapi_struct->status, MGC_MCAPI_ERR_NOT_CONNECTED);
7148
 
7149
    req_ptr[0] = &request1;
7150
    req_ptr[1] = &request2;
7151
    req_ptr[2] = &request3;
7152
    req_ptr[3] = &request4;
7153
    req_ptr[4] = &request5;
7154
    req_ptr[5] = &request6;
7155
    req_ptr[6] = &request7;
7156
 
7157
    /* Wait for the call to timeout. */
7158
    finished =
7159
        mcapi_wait_any(7, req_ptr, &rx_len, 250, &mcapi_struct->status);
7160
 
7161
    if (mcapi_struct->status == MCAPI_TIMEOUT)
7162
    {
7163
        mcapi_struct->status = MCAPI_SUCCESS;
7164
    }
7165
 
7166
    /* Cancel each request. */
7167
    for (i = 0; i < 7; i ++)
7168
    {
7169
        mcapi_cancel(req_ptr[i], &status);
7170
    }
7171
 
7172
    /* Close the receive side of the packet channel. */
7173
    mcapi_packetchan_recv_close_i(rx_handle, &mcapi_struct->request, &status);
7174
 
7175
    /* Delete each endpoint. */
7176
    mcapi_delete_endpoint(rx_endp1, &status);
7177
    status_assert(status);
7178
    mcapi_delete_endpoint(rx_endp2, &status);
7179
    status_assert(status);
7180
    mcapi_delete_endpoint(rx_endp3, &status);
7181
    status_assert(status);
7182
    mcapi_delete_endpoint(rx_endp4, &status);
7183
    status_assert(status);
7184
    mcapi_delete_endpoint(tx_endp1, &status);
7185
    status_assert(status);
7186
    mcapi_delete_endpoint(tx_endp2, &status);
7187
    status_assert(status);
7188
 
7189
    /* Indicate that the send side should be closed. */
7190
    status =
7191
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_PKT, 1025,
7192
                               mcapi_struct->local_endp, 0,
7193
                               MCAPI_DEFAULT_PRIO);
7194
 
7195
    if (status == MCAPI_SUCCESS)
7196
    {
7197
        /* Wait for a response. */
7198
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7199
    }
7200
 
7201
    /* Indicate that an endpoint should be deleted. */
7202
    status =
7203
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1025,
7204
                               mcapi_struct->local_endp, 0,
7205
                               MCAPI_DEFAULT_PRIO);
7206
 
7207
    if (status == MCAPI_SUCCESS)
7208
    {
7209
        /* Wait for a response. */
7210
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7211
    }
7212
 
7213
    /* Set the state of the test to completed. */
7214
    mcapi_struct->state = 0;
7215
 
7216
    /* Allow the next test to run. */
7217
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
7218
 
7219
} /* MCAPI_FTS_Tx_2_35_64 */
7220
 
7221
#ifdef LCL_MGMT_UNBROKEN
7222
/************************************************************************
7223
*
7224
*   FUNCTION
7225
*
7226
*       MCAPI_FTS_Tx_2_35_65
7227
*
7228
*   DESCRIPTION
7229
*
7230
*       Testing mcapi_wait_any - one of each type, operate on last request
7231
*       until all requests operated on – cancel
7232
*
7233
*           Node 1 – Get foreign endpoint, issue call to receive message,
7234
*                    open receive side of packet channel, open send side
7235
*                    of packet channel, make call to receive data on packet
7236
*                    channel, open receive side of scalar channel, open
7237
*                    send side of scalar channel – remove requests from
7238
*                    list one by one as cancel occurs until no requests
7239
*                    remain
7240
*
7241
*************************************************************************/
7242
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_65)
7243
{
7244
    MCAPID_STRUCT               *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
7245
    mcapi_endpoint_t            endpoint, rx_endp1, rx_endp2, rx_endp3,
7246
                                rx_endp4, tx_endp1, tx_endp2, foreign_tx_endp1;
7247
    size_t                      rx_len;
7248
    mcapi_status_t              status;
7249
    mcapi_boolean_t             finished;
7250
    mcapi_request_t             *req_ptr[7];
7251
    mcapi_request_t             request1, request2, request3, request4,
7252
                                request5, request6, request7;
7253
    mcapi_pktchan_recv_hndl_t   rx_handle;
7254
    char                        *pkt_ptr;
7255
    char                        buffer[MCAPID_MSG_LEN];
7256
    int                         i;
7257
 
7258
    /* Don't let any other test run while this test is running. */
7259
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
7260
 
7261
    /* Set up the structure for getting the local management server. */
7262
    svc_struct.type = MCAPI_MSG_TX_TYPE;
7263
    svc_struct.local_port = MCAPI_PORT_ANY;
7264
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
7265
    svc_struct.service = "lcl_mgmt";
7266
    svc_struct.thread_entry = MCAPI_NULL;
7267
 
7268
    /* Create the client service. */
7269
    MCAPID_Create_Service(&svc_struct);
7270
 
7271
    /* Get a foreign endpoint. */
7272
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
7273
                         &request1, &mcapi_struct->status);
7274
 
7275
    if (mcapi_struct->status == MCAPI_SUCCESS)
7276
    {
7277
        /* Create an endpoint for receiving messages. */
7278
        rx_endp1 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7279
 
7280
        if (mcapi_struct->status == MCAPI_SUCCESS)
7281
        {
7282
            /* Make the call to receive data on this endpoint. */
7283
            mcapi_msg_recv_i(rx_endp1, buffer, MCAPID_MSG_LEN, &request2,
7284
                             &mcapi_struct->status);
7285
        }
7286
    }
7287
 
7288
    if (mcapi_struct->status == MCAPI_SUCCESS)
7289
    {
7290
        /* Create an endpoint for the receive side of a packet channel. */
7291
        rx_endp2 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7292
 
7293
        if (mcapi_struct->status == MCAPI_SUCCESS)
7294
        {
7295
            /* Open receive side of a packet channel. */
7296
            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
7297
                                      rx_endp2, &request3, &mcapi_struct->status);
7298
        }
7299
    }
7300
 
7301
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
7302
    {
7303
        /* Create an endpoint for the send side of a packet channel. */
7304
        tx_endp1 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7305
 
7306
        if (mcapi_struct->status == MCAPI_SUCCESS)
7307
        {
7308
            /* Open send side of a packet channel. */
7309
            mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
7310
                                      tx_endp1, &request4, &mcapi_struct->status);
7311
        }
7312
    }
7313
 
7314
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
7315
    {
7316
        /* Indicate that an endpoint should be created. */
7317
        mcapi_struct->status =
7318
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1025,
7319
                                   mcapi_struct->local_endp, 0,
7320
                                   MCAPI_DEFAULT_PRIO);
7321
 
7322
        if (mcapi_struct->status == MCAPI_SUCCESS)
7323
        {
7324
            /* Wait for a response. */
7325
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7326
 
7327
            if (mcapi_struct->status == MCAPI_SUCCESS)
7328
            {
7329
                /* Indicate that the send side should be opened. */
7330
                mcapi_struct->status =
7331
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT, 1025,
7332
                                           mcapi_struct->local_endp, 0,
7333
                                           MCAPI_DEFAULT_PRIO);
7334
 
7335
                /* Wait for a response. */
7336
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7337
            }
7338
        }
7339
 
7340
        if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
7341
        {
7342
            /* Get the foreign endpoint. */
7343
            foreign_tx_endp1 = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1025,
7344
                                                  &mcapi_struct->status);
7345
 
7346
            if (mcapi_struct->status == MCAPI_SUCCESS)
7347
            {
7348
                /* Create an endpoint for the receive side of a packet channel. */
7349
                rx_endp3 =
7350
                    mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7351
 
7352
                if (mcapi_struct->status == MCAPI_SUCCESS)
7353
                {
7354
                    /* Connect the two endpoints. */
7355
                    mcapi_connect_pktchan_i(foreign_tx_endp1, rx_endp3,
7356
                                            &mcapi_struct->request,
7357
                                            &mcapi_struct->status);
7358
 
7359
                    if (mcapi_struct->status == MCAPI_SUCCESS)
7360
                    {
7361
                        /* Wait for the connection. */
7362
                        mcapi_wait(&mcapi_struct->request, &rx_len,
7363
                                   &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
7364
 
7365
                        /* Open receive side of a packet channel. */
7366
                        mcapi_open_pktchan_recv_i(&rx_handle, rx_endp3,
7367
                                                  &mcapi_struct->request,
7368
                                                  &mcapi_struct->status);
7369
 
7370
                        if (mcapi_struct->status == MCAPI_SUCCESS)
7371
                        {
7372
                            /* Wait for the open. */
7373
                            mcapi_wait(&mcapi_struct->request, &rx_len,
7374
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
7375
 
7376
                            /* Wait for data on the channel. */
7377
                            mcapi_pktchan_recv_i(rx_handle, (void**)&pkt_ptr, &request5,
7378
                                                 &mcapi_struct->status);
7379
                        }
7380
                    }
7381
                }
7382
            }
7383
        }
7384
    }
7385
 
7386
    if (mcapi_struct->status == MCAPI_SUCCESS)
7387
    {
7388
        /* Create an endpoint for the receive side of a scalar channel. */
7389
        rx_endp4 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7390
 
7391
        if (mcapi_struct->status == MCAPI_SUCCESS)
7392
        {
7393
            /* Open receive side of a scalar channel. */
7394
            mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
7395
                                      rx_endp4, &request6, &mcapi_struct->status);
7396
        }
7397
    }
7398
 
7399
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
7400
    {
7401
        /* Create an endpoint for the send side of a scalar channel. */
7402
        tx_endp2 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7403
 
7404
        if (mcapi_struct->status == MCAPI_SUCCESS)
7405
        {
7406
            /* Open send side of a scalar channel. */
7407
            mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
7408
                                      tx_endp2, &request7, &mcapi_struct->status);
7409
        }
7410
    }
7411
 
7412
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
7413
    {
7414
        req_ptr[0] = &request1;
7415
        req_ptr[1] = &request2;
7416
        req_ptr[2] = &request3;
7417
        req_ptr[3] = &request4;
7418
        req_ptr[4] = &request5;
7419
        req_ptr[5] = &request6;
7420
        req_ptr[6] = &request7;
7421
 
7422
        for (i = 6; i >= 0; i --)
7423
        {
7424
            /* Store the request to cancel. */
7425
            memcpy(&svc_struct.request, req_ptr[i], sizeof(mcapi_request_t));
7426
 
7427
            /* Cause the call to be canceled. */
7428
            mcapi_struct->status =
7429
                MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
7430
                                       svc_struct.local_endp, 500, MCAPI_DEFAULT_PRIO);
7431
 
7432
            /* Wait for the call to be canceled. */
7433
            finished = mcapi_wait_any(i + 1, req_ptr, &rx_len,
7434
                                      MCAPI_FTS_TIMEOUT,
7435
                                      &mcapi_struct->status);
7436
 
7437
            /* If the request was canceled. */
7438
            if ( (finished == i) &&
7439
                 (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) )
7440
            {
7441
                mcapi_struct->status = MCAPI_SUCCESS;
7442
            }
7443
 
7444
            /* Otherwise, manually cancel the remaining requests. */
7445
            else
7446
            {
7447
                mcapi_struct->status = -1;
7448
 
7449
                /* Cancel each remaining request. */
7450
                for (; i >= 0; i --)
7451
                {
7452
                    mcapi_cancel(req_ptr[i], &status);
7453
                }
7454
 
7455
                break;
7456
            }
7457
        }
7458
    }
7459
 
7460
    /* Close the receive side of the packet channel. */
7461
    mcapi_packetchan_recv_close_i(rx_handle, &mcapi_struct->request, &status);
7462
 
7463
    /* Delete each endpoint. */
7464
    mcapi_delete_endpoint(rx_endp1, &status);
7465
    mcapi_delete_endpoint(rx_endp2, &status);
7466
    mcapi_delete_endpoint(rx_endp3, &status);
7467
    mcapi_delete_endpoint(rx_endp4, &status);
7468
    mcapi_delete_endpoint(tx_endp1, &status);
7469
    mcapi_delete_endpoint(tx_endp2, &status);
7470
 
7471
    /* Indicate that the send side should be closed. */
7472
    status =
7473
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_PKT, 1025,
7474
                               mcapi_struct->local_endp, 0,
7475
                               MCAPI_DEFAULT_PRIO);
7476
 
7477
    if (status == MCAPI_SUCCESS)
7478
    {
7479
        /* Wait for a response. */
7480
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7481
    }
7482
 
7483
    /* Indicate that an endpoint should be deleted. */
7484
    status =
7485
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1025,
7486
                               mcapi_struct->local_endp, 0,
7487
                               MCAPI_DEFAULT_PRIO);
7488
 
7489
    if (status == MCAPI_SUCCESS)
7490
    {
7491
        /* Wait for a response. */
7492
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7493
    }
7494
 
7495
    /* Destroy the client service. */
7496
    MCAPID_Destroy_Service(&svc_struct, 1);
7497
 
7498
    /* Set the state of the test to completed. */
7499
    mcapi_struct->state = 0;
7500
 
7501
    /* Allow the next test to run. */
7502
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
7503
 
7504
} /* MCAPI_FTS_Tx_2_35_65 */
7505
#endif
7506
 
7507
#ifdef LCL_MGMT_UNBROKEN
7508
/************************************************************************
7509
*
7510
*   FUNCTION
7511
*
7512
*       MCAPI_FTS_Tx_2_35_66
7513
*
7514
*   DESCRIPTION
7515
*
7516
*       Testing mcapi_wait_any - one of each type, operate on last request
7517
*       until all requests operated on – completed
7518
*
7519
*           Node 1 – Get foreign endpoint, issue call to receive message,
7520
*                    open receive side of packet channel, open send side
7521
*                    of packet channel, make call to receive data on packet
7522
*                    channel, open receive side of scalar channel, open
7523
*                    send side of scalar channel – complete requests one
7524
*                    by one as cancel occurs until no requests remain
7525
*
7526
*************************************************************************/
7527
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_35_66)
7528
{
7529
    MCAPID_STRUCT               *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
7530
    mcapi_endpoint_t            endpoint, rx_endp1, rx_endp2, rx_endp3,
7531
                                rx_endp4, tx_endp1, tx_endp2,
7532
                                foreign_tx_endp1, foreign_tx_endp,
7533
                                foreign_rx_endp, local_endp;
7534
    size_t                      rx_len;
7535
    mcapi_status_t              status;
7536
    mcapi_boolean_t             finished;
7537
    mcapi_request_t             *req_ptr[7];
7538
    mcapi_request_t             request1, request2, request3, request4,
7539
                                request5, request6, request7;
7540
    mcapi_pktchan_recv_hndl_t   rx_handle;
7541
    char                        *pkt_ptr;
7542
    char                        buffer[MCAPID_MSG_LEN];
7543
    int                         i;
7544
 
7545
    /* Don't let any other test run while this test is running. */
7546
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
7547
 
7548
    /* Set up the structure for getting the local management server. */
7549
    svc_struct.type = MCAPI_MSG_TX_TYPE;
7550
    svc_struct.local_port = MCAPI_PORT_ANY;
7551
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
7552
    svc_struct.service = "lcl_mgmt";
7553
    svc_struct.thread_entry = MCAPI_NULL;
7554
 
7555
    /* Create the client service. */
7556
    MCAPID_Create_Service(&svc_struct);
7557
 
7558
    /* Get a foreign endpoint. */
7559
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
7560
                         &request1, &mcapi_struct->status);
7561
 
7562
    if (mcapi_struct->status == MCAPI_SUCCESS)
7563
    {
7564
        /* Create an endpoint for receiving messages. */
7565
        rx_endp1 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7566
 
7567
        if (mcapi_struct->status == MCAPI_SUCCESS)
7568
        {
7569
            /* Make the call to receive data on this endpoint. */
7570
            mcapi_msg_recv_i(rx_endp1, buffer, MCAPID_MSG_LEN, &request2,
7571
                             &mcapi_struct->status);
7572
        }
7573
    }
7574
 
7575
    if (mcapi_struct->status == MCAPI_SUCCESS)
7576
    {
7577
        /* Create an endpoint for the receive side of a packet channel. */
7578
        rx_endp2 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7579
 
7580
        if (mcapi_struct->status == MCAPI_SUCCESS)
7581
        {
7582
            /* Open receive side of a packet channel. */
7583
            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
7584
                                      rx_endp2, &request3, &mcapi_struct->status);
7585
        }
7586
    }
7587
 
7588
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
7589
    {
7590
        /* Create an endpoint for the send side of a packet channel. */
7591
        tx_endp1 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7592
 
7593
        if (mcapi_struct->status == MCAPI_SUCCESS)
7594
        {
7595
            /* Open send side of a packet channel. */
7596
            mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
7597
                                      tx_endp1, &request4, &mcapi_struct->status);
7598
        }
7599
    }
7600
 
7601
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
7602
    {
7603
        /* Indicate that an endpoint should be created. */
7604
        mcapi_struct->status =
7605
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1025,
7606
                                   mcapi_struct->local_endp, 0,
7607
                                   MCAPI_DEFAULT_PRIO);
7608
 
7609
        if (mcapi_struct->status == MCAPI_SUCCESS)
7610
        {
7611
            /* Wait for a response. */
7612
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7613
 
7614
            if (mcapi_struct->status == MCAPI_SUCCESS)
7615
            {
7616
                /* Indicate that the send side should be opened. */
7617
                mcapi_struct->status =
7618
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT, 1025,
7619
                                           mcapi_struct->local_endp, 0,
7620
                                           MCAPI_DEFAULT_PRIO);
7621
 
7622
                /* Wait for a response. */
7623
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7624
            }
7625
        }
7626
 
7627
        if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
7628
        {
7629
            /* Get the foreign endpoint. */
7630
            foreign_tx_endp1 = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1025,
7631
                                                  &mcapi_struct->status);
7632
 
7633
            if (mcapi_struct->status == MCAPI_SUCCESS)
7634
            {
7635
                /* Create an endpoint for the receive side of a packet channel. */
7636
                rx_endp3 =
7637
                    mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7638
 
7639
                if (mcapi_struct->status == MCAPI_SUCCESS)
7640
                {
7641
                    /* Connect the two endpoints. */
7642
                    mcapi_connect_pktchan_i(foreign_tx_endp1, rx_endp3,
7643
                                            &mcapi_struct->request,
7644
                                            &mcapi_struct->status);
7645
 
7646
                    if (mcapi_struct->status == MCAPI_SUCCESS)
7647
                    {
7648
                        /* Wait for the connection. */
7649
                        mcapi_wait(&mcapi_struct->request, &rx_len,
7650
                                   &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
7651
 
7652
                        /* Open receive side of a packet channel. */
7653
                        mcapi_open_pktchan_recv_i(&rx_handle, rx_endp3,
7654
                                                  &mcapi_struct->request,
7655
                                                  &mcapi_struct->status);
7656
 
7657
                        if (mcapi_struct->status == MCAPI_SUCCESS)
7658
                        {
7659
                            /* Wait for the open. */
7660
                            mcapi_wait(&mcapi_struct->request, &rx_len,
7661
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
7662
 
7663
                            /* Wait for data on the channel. */
7664
                            mcapi_pktchan_recv_i(rx_handle, (void**)&pkt_ptr, &request5,
7665
                                                 &mcapi_struct->status);
7666
                        }
7667
                    }
7668
                }
7669
            }
7670
        }
7671
    }
7672
 
7673
    if (mcapi_struct->status == MCAPI_SUCCESS)
7674
    {
7675
        /* Create an endpoint for the receive side of a scalar channel. */
7676
        rx_endp4 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7677
 
7678
        if (mcapi_struct->status == MCAPI_SUCCESS)
7679
        {
7680
            /* Open receive side of a scalar channel. */
7681
            mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
7682
                                      rx_endp4, &request6, &mcapi_struct->status);
7683
        }
7684
    }
7685
 
7686
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
7687
    {
7688
        /* Create an endpoint for the send side of a scalar channel. */
7689
        tx_endp2 = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
7690
 
7691
        if (mcapi_struct->status == MCAPI_SUCCESS)
7692
        {
7693
            /* Open send side of a scalar channel. */
7694
            mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
7695
                                      tx_endp2, &request7, &mcapi_struct->status);
7696
        }
7697
    }
7698
 
7699
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
7700
    {
7701
        req_ptr[0] = &request1;
7702
        req_ptr[1] = &request2;
7703
        req_ptr[2] = &request3;
7704
        req_ptr[3] = &request4;
7705
        req_ptr[4] = &request5;
7706
        req_ptr[5] = &request6;
7707
        req_ptr[6] = &request7;
7708
 
7709
        i = 7;
7710
 
7711
        /* Initialize status. */
7712
        mcapi_struct->status = MCAPI_SUCCESS;
7713
 
7714
        /* Open receive side of scalar connection and issue connection. */
7715
        if (mcapi_struct->status == MCAPI_SUCCESS)
7716
        {
7717
            i --;
7718
 
7719
            /* Indicate that an endpoint should be created. */
7720
            mcapi_struct->status =
7721
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1026,
7722
                                       mcapi_struct->local_endp, 0,
7723
                                       MCAPI_DEFAULT_PRIO);
7724
 
7725
            if (mcapi_struct->status == MCAPI_SUCCESS)
7726
            {
7727
                /* Wait for a response. */
7728
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7729
 
7730
                if (mcapi_struct->status == MCAPI_SUCCESS)
7731
                {
7732
                    /* Get the foreign endpoint. */
7733
                    foreign_rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1026,
7734
                                                         &mcapi_struct->status);
7735
 
7736
                    if (mcapi_struct->status == MCAPI_SUCCESS)
7737
                    {
7738
                        /* Connect the two endpoints. */
7739
                        mcapi_connect_sclchan_i(tx_endp2, foreign_rx_endp,
7740
                                                &mcapi_struct->request,
7741
                                                &mcapi_struct->status);
7742
 
7743
                        if (mcapi_struct->status == MCAPI_SUCCESS)
7744
                        {
7745
                            /* Wait for the connection. */
7746
                            mcapi_wait(&mcapi_struct->request, &rx_len,
7747
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
7748
 
7749
                            /* Indicate that the receive side should be opened. */
7750
                            mcapi_struct->status =
7751
                                MCAPID_TX_Mgmt_Message(mcapi_struct,
7752
                                                       MCAPID_MGMT_OPEN_RX_SIDE_SCL,
7753
                                                       1026, mcapi_struct->local_endp, 500,
7754
                                                       MCAPI_DEFAULT_PRIO);
7755
 
7756
                            /* Wait for the call to complete. */
7757
                            finished = mcapi_wait_any(i + 1, req_ptr,
7758
                                                      &rx_len,
7759
                                                      MCAPI_FTS_TIMEOUT,
7760
                                                      &mcapi_struct->status);
7761
 
7762
                            /* If the request was canceled. */
7763
                            if ( (finished != i) ||
7764
                                 (mcapi_struct->status != MCAPI_SUCCESS) )
7765
                            {
7766
                                mcapi_struct->status = -1;
7767
                            }
7768
 
7769
                            /* Wait for a response to the open request. */
7770
                            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7771
 
7772
                            if (status == MCAPI_SUCCESS)
7773
                            {
7774
                                /* Indicate that the receive side should be closed. */
7775
                                status =
7776
                                    MCAPID_TX_Mgmt_Message(mcapi_struct,
7777
                                                           MCAPID_MGMT_CLOSE_RX_SIDE_SCL, 1026,
7778
                                                           mcapi_struct->local_endp, 0,
7779
                                                           MCAPI_DEFAULT_PRIO);
7780
 
7781
                                if (status == MCAPI_SUCCESS)
7782
                                {
7783
                                    /* Wait for a response. */
7784
                                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7785
                                }
7786
                            }
7787
                        }
7788
                    }
7789
 
7790
                    /* Indicate that an endpoint should be deleted. */
7791
                    status =
7792
                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1026,
7793
                                               mcapi_struct->local_endp, 0,
7794
                                               MCAPI_DEFAULT_PRIO);
7795
 
7796
                    if (status == MCAPI_SUCCESS)
7797
                    {
7798
                        /* Wait for a response. */
7799
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7800
                    }
7801
                }
7802
            }
7803
        }
7804
 
7805
        /* Open send side of scalar connection and issue connection. */
7806
        if (mcapi_struct->status == MCAPI_SUCCESS)
7807
        {
7808
            i --;
7809
 
7810
            /* Indicate that an endpoint should be created. */
7811
            mcapi_struct->status =
7812
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1026,
7813
                                       mcapi_struct->local_endp, 0,
7814
                                       MCAPI_DEFAULT_PRIO);
7815
 
7816
            if (mcapi_struct->status == MCAPI_SUCCESS)
7817
            {
7818
                /* Wait for a response. */
7819
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7820
 
7821
                if (mcapi_struct->status == MCAPI_SUCCESS)
7822
                {
7823
                    /* Get the foreign endpoint. */
7824
                    foreign_tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1026,
7825
                                                         &mcapi_struct->status);
7826
 
7827
                    if (mcapi_struct->status == MCAPI_SUCCESS)
7828
                    {
7829
                        /* Connect the two endpoints. */
7830
                        mcapi_connect_sclchan_i(foreign_tx_endp, rx_endp4,
7831
                                                &mcapi_struct->request,
7832
                                                &mcapi_struct->status);
7833
 
7834
                        if (mcapi_struct->status == MCAPI_SUCCESS)
7835
                        {
7836
                            /* Wait for the connection. */
7837
                            mcapi_wait(&mcapi_struct->request, &rx_len,
7838
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
7839
 
7840
                            /* Indicate that the send side should be opened. */
7841
                            mcapi_struct->status =
7842
                                MCAPID_TX_Mgmt_Message(mcapi_struct,
7843
                                                       MCAPID_MGMT_OPEN_TX_SIDE_SCL,
7844
                                                       1026, mcapi_struct->local_endp, 500,
7845
                                                       MCAPI_DEFAULT_PRIO);
7846
 
7847
                            /* Wait for the call to complete. */
7848
                            finished = mcapi_wait_any(i + 1, req_ptr,
7849
                                                      &rx_len,
7850
                                                      MCAPI_FTS_TIMEOUT,
7851
                                                      &mcapi_struct->status);
7852
 
7853
                            /* If the request was canceled. */
7854
                            if ( (finished != i) ||
7855
                                 (mcapi_struct->status != MCAPI_SUCCESS) )
7856
                            {
7857
                                mcapi_struct->status = -1;
7858
                            }
7859
 
7860
                            /* Wait for a response to the open request. */
7861
                            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7862
 
7863
                            if (status == MCAPI_SUCCESS)
7864
                            {
7865
                                /* Indicate that the send side should be closed. */
7866
                                status =
7867
                                    MCAPID_TX_Mgmt_Message(mcapi_struct,
7868
                                                           MCAPID_MGMT_CLOSE_TX_SIDE_SCL, 1026,
7869
                                                           mcapi_struct->local_endp, 0,
7870
                                                           MCAPI_DEFAULT_PRIO);
7871
 
7872
                                if (status == MCAPI_SUCCESS)
7873
                                {
7874
                                    /* Wait for a response. */
7875
                                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7876
                                }
7877
                            }
7878
                        }
7879
                    }
7880
 
7881
                    /* Indicate that an endpoint should be deleted. */
7882
                    status =
7883
                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1026,
7884
                                               mcapi_struct->local_endp, 0,
7885
                                               MCAPI_DEFAULT_PRIO);
7886
 
7887
                    if (status == MCAPI_SUCCESS)
7888
                    {
7889
                        /* Wait for a response. */
7890
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7891
                    }
7892
                }
7893
            }
7894
        }
7895
 
7896
        /* Send data over packet channel connection. */
7897
        if (mcapi_struct->status == MCAPI_SUCCESS)
7898
        {
7899
            i --;
7900
 
7901
            /* Indicate that data should be transmitted over the connection. */
7902
            mcapi_struct->status =
7903
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_TX_PKT, 1025,
7904
                                       mcapi_struct->local_endp, 500,
7905
                                       MCAPI_DEFAULT_PRIO);
7906
 
7907
            if (mcapi_struct->status == MCAPI_SUCCESS)
7908
            {
7909
                /* Wait for the call to complete. */
7910
                finished = mcapi_wait_any(i + 1, req_ptr, &rx_len,
7911
                                          MCAPI_FTS_TIMEOUT,
7912
                                          &mcapi_struct->status);
7913
 
7914
                /* If the request was canceled. */
7915
                if ( (finished != i) ||
7916
                     (mcapi_struct->status != MCAPI_SUCCESS) )
7917
                {
7918
                    mcapi_struct->status = -1;
7919
                }
7920
 
7921
                else
7922
                {
7923
                    mcapi_pktchan_free(pkt_ptr, &status);
7924
                }
7925
 
7926
                /* Wait for a response to the transmission request. */
7927
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7928
            }
7929
 
7930
            /* Indicate that the send side should be closed. */
7931
            status =
7932
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CLOSE_TX_SIDE_PKT, 1025,
7933
                                       mcapi_struct->local_endp, 0,
7934
                                       MCAPI_DEFAULT_PRIO);
7935
 
7936
            if (status == MCAPI_SUCCESS)
7937
            {
7938
                /* Wait for a response. */
7939
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7940
            }
7941
 
7942
            /* Indicate that an endpoint should be deleted. */
7943
            status =
7944
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1025,
7945
                                       mcapi_struct->local_endp, 0,
7946
                                       MCAPI_DEFAULT_PRIO);
7947
 
7948
            if (status == MCAPI_SUCCESS)
7949
            {
7950
                /* Wait for a response. */
7951
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7952
            }
7953
        }
7954
 
7955
        /* Open receive side of packet connection and issue connection. */
7956
        if (mcapi_struct->status == MCAPI_SUCCESS)
7957
        {
7958
            i --;
7959
 
7960
            /* Indicate that an endpoint should be created. */
7961
            mcapi_struct->status =
7962
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1026,
7963
                                       mcapi_struct->local_endp, 0,
7964
                                       MCAPI_DEFAULT_PRIO);
7965
 
7966
            if (mcapi_struct->status == MCAPI_SUCCESS)
7967
            {
7968
                /* Wait for a response. */
7969
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
7970
 
7971
                if (mcapi_struct->status == MCAPI_SUCCESS)
7972
                {
7973
                    /* Get the foreign endpoint. */
7974
                    foreign_rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1026,
7975
                                                         &mcapi_struct->status);
7976
 
7977
                    if (mcapi_struct->status == MCAPI_SUCCESS)
7978
                    {
7979
                        /* Connect the two endpoints. */
7980
                        mcapi_connect_pktchan_i(tx_endp1, foreign_rx_endp,
7981
                                                &mcapi_struct->request,
7982
                                                &mcapi_struct->status);
7983
 
7984
                        if (mcapi_struct->status == MCAPI_SUCCESS)
7985
                        {
7986
                            /* Wait for the connection. */
7987
                            mcapi_wait(&mcapi_struct->request, &rx_len,
7988
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
7989
 
7990
                            /* Indicate that the receive side should be opened. */
7991
                            mcapi_struct->status =
7992
                                MCAPID_TX_Mgmt_Message(mcapi_struct,
7993
                                                       MCAPID_MGMT_OPEN_RX_SIDE_PKT,
7994
                                                       1026, mcapi_struct->local_endp, 500,
7995
                                                       MCAPI_DEFAULT_PRIO);
7996
 
7997
                            /* Wait for the call to complete. */
7998
                            finished = mcapi_wait_any(i + 1, req_ptr,
7999
                                                      &rx_len,
8000
                                                      MCAPI_FTS_TIMEOUT,
8001
                                                      &mcapi_struct->status);
8002
 
8003
                            /* If the request was canceled. */
8004
                            if ( (finished != i) ||
8005
                                 (mcapi_struct->status != MCAPI_SUCCESS) )
8006
                            {
8007
                                mcapi_struct->status = -1;
8008
                            }
8009
 
8010
                            /* Wait for a response to the open request. */
8011
                            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8012
 
8013
                            if (status == MCAPI_SUCCESS)
8014
                            {
8015
                                /* Indicate that the receive side should be closed. */
8016
                                status =
8017
                                    MCAPID_TX_Mgmt_Message(mcapi_struct,
8018
                                                           MCAPID_MGMT_CLOSE_RX_SIDE_PKT, 1026,
8019
                                                           mcapi_struct->local_endp, 0,
8020
                                                           MCAPI_DEFAULT_PRIO);
8021
 
8022
                                if (status == MCAPI_SUCCESS)
8023
                                {
8024
                                    /* Wait for a response. */
8025
                                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8026
                                }
8027
                            }
8028
                        }
8029
                    }
8030
 
8031
                    /* Indicate that an endpoint should be deleted. */
8032
                    status =
8033
                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1026,
8034
                                               mcapi_struct->local_endp, 0,
8035
                                               MCAPI_DEFAULT_PRIO);
8036
 
8037
                    if (status == MCAPI_SUCCESS)
8038
                    {
8039
                        /* Wait for a response. */
8040
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8041
                    }
8042
                }
8043
            }
8044
        }
8045
 
8046
        /* Open send side of packet connection and issue connection. */
8047
        if (mcapi_struct->status == MCAPI_SUCCESS)
8048
        {
8049
            i --;
8050
 
8051
            /* Indicate that an endpoint should be created. */
8052
            mcapi_struct->status =
8053
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1026,
8054
                                       mcapi_struct->local_endp, 0,
8055
                                       MCAPI_DEFAULT_PRIO);
8056
 
8057
            if (mcapi_struct->status == MCAPI_SUCCESS)
8058
            {
8059
                /* Wait for a response. */
8060
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8061
 
8062
                if (mcapi_struct->status == MCAPI_SUCCESS)
8063
                {
8064
                    /* Get the foreign endpoint. */
8065
                    foreign_tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1026,
8066
                                                         &mcapi_struct->status);
8067
 
8068
                    if (mcapi_struct->status == MCAPI_SUCCESS)
8069
                    {
8070
                        /* Connect the two endpoints. */
8071
                        mcapi_connect_pktchan_i(foreign_tx_endp, rx_endp2,
8072
                                                &mcapi_struct->request,
8073
                                                &mcapi_struct->status);
8074
 
8075
                        if (mcapi_struct->status == MCAPI_SUCCESS)
8076
                        {
8077
                            /* Wait for the connection. */
8078
                            mcapi_wait(&mcapi_struct->request, &rx_len,
8079
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
8080
 
8081
                            /* Indicate that the send side should be opened. */
8082
                            mcapi_struct->status =
8083
                                MCAPID_TX_Mgmt_Message(mcapi_struct,
8084
                                                       MCAPID_MGMT_OPEN_TX_SIDE_PKT,
8085
                                                       1026, mcapi_struct->local_endp, 500,
8086
                                                       MCAPI_DEFAULT_PRIO);
8087
 
8088
                            /* Wait for the call to complete. */
8089
                            finished = mcapi_wait_any(i + 1, req_ptr,
8090
                                                      &rx_len,
8091
                                                      MCAPI_FTS_TIMEOUT,
8092
                                                      &mcapi_struct->status);
8093
 
8094
                            /* If the request was canceled. */
8095
                            if ( (finished != i) ||
8096
                                 (mcapi_struct->status != MCAPI_SUCCESS) )
8097
                            {
8098
                                mcapi_struct->status = -1;
8099
                            }
8100
 
8101
                            /* Wait for a response to the open request. */
8102
                            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8103
 
8104
                            if (status == MCAPI_SUCCESS)
8105
                            {
8106
                                /* Indicate that the send side should be closed. */
8107
                                status =
8108
                                    MCAPID_TX_Mgmt_Message(mcapi_struct,
8109
                                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT, 1026,
8110
                                                           mcapi_struct->local_endp, 0,
8111
                                                           MCAPI_DEFAULT_PRIO);
8112
 
8113
                                if (status == MCAPI_SUCCESS)
8114
                                {
8115
                                    /* Wait for a response. */
8116
                                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8117
                                }
8118
                            }
8119
                        }
8120
                    }
8121
 
8122
                    /* Indicate that an endpoint should be deleted. */
8123
                    status =
8124
                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1026,
8125
                                               mcapi_struct->local_endp, 0,
8126
                                               MCAPI_DEFAULT_PRIO);
8127
 
8128
                    if (status == MCAPI_SUCCESS)
8129
                    {
8130
                        /* Wait for a response. */
8131
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8132
                    }
8133
                }
8134
            }
8135
        }
8136
 
8137
        /* Send message to open receive endpoint. */
8138
        if (mcapi_struct->status == MCAPI_SUCCESS)
8139
        {
8140
            i --;
8141
 
8142
            /* Create foreign endpoint. */
8143
            mcapi_struct->status =
8144
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1026,
8145
                                       mcapi_struct->local_endp, 0,
8146
                                       MCAPI_DEFAULT_PRIO);
8147
 
8148
            if (mcapi_struct->status == MCAPI_SUCCESS)
8149
            {
8150
                /* Wait for a response. */
8151
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8152
 
8153
                if (mcapi_struct->status == MCAPI_SUCCESS)
8154
                {
8155
                    /* Save the local endpoint. */
8156
                    local_endp = mcapi_struct->local_endp;
8157
 
8158
                    /* Set the receive endpoint. */
8159
                    mcapi_struct->local_endp = rx_endp1;
8160
 
8161
                    /* Cause the other side to send a message to the other endpoint. */
8162
                    mcapi_struct->status =
8163
                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_TX_BLCK_MSG, 1026,
8164
                                               mcapi_struct->local_endp, 500,
8165
                                               MCAPI_DEFAULT_PRIO);
8166
 
8167
                    /* Wait for the call to complete. */
8168
                    finished = mcapi_wait_any(i + 1, req_ptr, &rx_len,
8169
                                              MCAPI_FTS_TIMEOUT,
8170
                                              &mcapi_struct->status);
8171
 
8172
                    /* If the request was canceled. */
8173
                    if ( (finished != i) ||
8174
                         (mcapi_struct->status != MCAPI_SUCCESS) )
8175
                    {
8176
                        mcapi_struct->status = -1;
8177
                    }
8178
 
8179
                    /* Wait for the response. */
8180
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8181
 
8182
                    /* Restore the local endpoint. */
8183
                    mcapi_struct->local_endp = local_endp;
8184
 
8185
                    /* Cause the other side to delete the endpoint */
8186
                    status =
8187
                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1026,
8188
                                               mcapi_struct->local_endp, 0,
8189
                                               MCAPI_DEFAULT_PRIO);
8190
 
8191
                    if (status == MCAPI_SUCCESS)
8192
                    {
8193
                        /* Wait for the response. */
8194
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8195
                    }
8196
                }
8197
            }
8198
        }
8199
 
8200
        /* Create foreign endpoint. */
8201
        if (mcapi_struct->status == MCAPI_SUCCESS)
8202
        {
8203
            i --;
8204
 
8205
            /* Create foreign endpoint. */
8206
            mcapi_struct->status =
8207
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
8208
                                       mcapi_struct->local_endp, 500,
8209
                                       MCAPI_DEFAULT_PRIO);
8210
 
8211
            /* Wait for the call to complete. */
8212
            finished = mcapi_wait_any(i + 1, req_ptr, &rx_len,
8213
                                      MCAPI_FTS_TIMEOUT,
8214
                                      &mcapi_struct->status);
8215
 
8216
            /* If the request was canceled. */
8217
            if ( (finished != i) ||
8218
                 (mcapi_struct->status != MCAPI_SUCCESS) )
8219
            {
8220
                mcapi_struct->status = -1;
8221
            }
8222
 
8223
            /* Wait for the response. */
8224
            status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8225
 
8226
            if (status == MCAPI_SUCCESS)
8227
            {
8228
                /* Cause the other side to delete the endpoint */
8229
                status =
8230
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
8231
                                           mcapi_struct->local_endp, 0,
8232
                                           MCAPI_DEFAULT_PRIO);
8233
 
8234
                if (status == MCAPI_SUCCESS)
8235
                {
8236
                    /* Wait for the response. */
8237
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
8238
                }
8239
            }
8240
        }
8241
 
8242
        if (mcapi_struct->status == MCAPI_SUCCESS)
8243
        {
8244
            i --;
8245
        }
8246
 
8247
        /* Cancel each remaining request. */
8248
        for (; i >= 0; i --)
8249
        {
8250
            mcapi_cancel(req_ptr[i], &status);
8251
        }
8252
    }
8253
 
8254
    /* Close the channels. */
8255
    mcapi_packetchan_recv_close_i(rx_handle, &mcapi_struct->request, &status);
8256
    mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle, &mcapi_struct->request, &status);
8257
    mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle, &mcapi_struct->request, &status);
8258
    mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle, &mcapi_struct->request, &status);
8259
    mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle, &mcapi_struct->request, &status);
8260
 
8261
    /* Delete each endpoint. */
8262
    mcapi_delete_endpoint(rx_endp1, &status);
8263
    mcapi_delete_endpoint(rx_endp2, &status);
8264
    mcapi_delete_endpoint(rx_endp3, &status);
8265
    mcapi_delete_endpoint(rx_endp4, &status);
8266
    mcapi_delete_endpoint(tx_endp1, &status);
8267
    mcapi_delete_endpoint(tx_endp2, &status);
8268
 
8269
    /* Destroy the client service. */
8270
    MCAPID_Destroy_Service(&svc_struct, 1);
8271
 
8272
    /* Set the state of the test to completed. */
8273
    mcapi_struct->state = 0;
8274
 
8275
    /* Allow the next test to run. */
8276
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
8277
 
8278
} /* MCAPI_FTS_Tx_2_35_66 */
8279
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.