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.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_34_1
48
*
49
*   DESCRIPTION
50
*
51
*       Testing mcapi_wait 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_34_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
 
66
    /* Don't let any other test run while this test is running. */
67
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
68
 
69
    /* Get the foreign endpoint. */
70
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
71
                         &mcapi_struct->request, &mcapi_struct->status);
72
 
73
    if (mcapi_struct->status == MCAPI_SUCCESS)
74
    {
75
        /* Wait for the call to timeout. */
76
        finished = mcapi_wait(&mcapi_struct->request, &rx_len,
77
                              &mcapi_struct->status, 250);
78
 
79
        if ( (finished == MCAPI_FALSE) &&
80
             (mcapi_struct->status == MCAPI_TIMEOUT) )
81
        {
82
            mcapi_struct->status = MCAPI_SUCCESS;
83
        }
84
 
85
        else
86
        {
87
            mcapi_struct->status = -1;
88
        }
89
 
90
        /* Cancel the request. */
91
        mcapi_cancel(&mcapi_struct->request, &status);
92
    }
93
 
94
    /* Set the state of the test to completed. */
95
    mcapi_struct->state = 0;
96
 
97
    /* Allow the next test to run. */
98
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
99
 
100
} /* MCAPI_FTS_Tx_2_34_1 */
101
 
102
/************************************************************************
103
*
104
*   FUNCTION
105
*
106
*       MCAPI_FTS_Tx_2_34_2
107
*
108
*   DESCRIPTION
109
*
110
*       Testing mcapi_wait while getting a foreign endpoint - request
111
*       canceled
112
*
113
*           Node 1 – Issue get endpoint request for non-existent endpoint
114
*                    on Node 0, wait for completion, request canceled.
115
*
116
*************************************************************************/
117
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_2)
118
{
119
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
120
    mcapi_endpoint_t    endpoint = 0xffffffff;
121
    size_t              rx_len;
122
    mcapi_status_t      status;
123
    mcapi_boolean_t     finished;
124
 
125
    /* Don't let any other test run while this test is running. */
126
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
127
 
128
    /* Get the foreign endpoint. */
129
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
130
                         &mcapi_struct->request, &mcapi_struct->status);
131
 
132
    if (mcapi_struct->status == MCAPI_SUCCESS)
133
    {
134
        /* Indicate that the request should be canceled in 1000 milliseconds. */
135
        mcapi_struct->status =
136
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_CANCEL_REQUEST, 0,
137
                                   mcapi_struct->local_endp, 1000,
138
                                   MCAPI_DEFAULT_PRIO);
139
 
140
        /* Wait for the other thread to cancel the request. */
141
        finished = mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
142
                              MCAPI_FTS_TIMEOUT);
143
 
144
        if ( (finished == MCAPI_FALSE) &&
145
             (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) )
146
        {
147
            mcapi_struct->status = MCAPI_SUCCESS;
148
        }
149
 
150
        else
151
        {
152
            mcapi_struct->status = -1;
153
        }
154
 
155
        /* Wait for a response that the cancel was successful. */
156
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
157
 
158
        if (status != MCAPI_SUCCESS)
159
        {
160
            mcapi_struct->status = -1;
161
        }
162
    }
163
 
164
    /* Set the state of the test to completed. */
165
    mcapi_struct->state = 0;
166
 
167
    /* Allow the next test to run. */
168
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
169
 
170
} /* MCAPI_FTS_Tx_2_34_2 */
171
 
172
/************************************************************************
173
*
174
*   FUNCTION
175
*
176
*       MCAPI_FTS_Tx_2_34_3
177
*
178
*   DESCRIPTION
179
*
180
*       Testing mcapi_wait while getting a foreign endpoint - endpoint
181
*       retrieved
182
*
183
*           Node 0 – Wait for get endpoint request, create endpoint
184
*
185
*           Node 1 – Issue get endpoint request for non-existent endpoint
186
*                    on Node 0, wait for completion
187
*
188
*************************************************************************/
189
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_3)
190
{
191
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
192
    mcapi_endpoint_t    endpoint = 0xffffffff;
193
    size_t              rx_len;
194
    mcapi_status_t      status;
195
    mcapi_boolean_t     finished;
196
 
197
    /* Don't let any other test run while this test is running. */
198
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
199
 
200
    /* Get the foreign endpoint. */
201
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
202
                         &mcapi_struct->request, &mcapi_struct->status);
203
 
204
    if (mcapi_struct->status == MCAPI_SUCCESS)
205
    {
206
        /* Indicate that the endpoint should be created in 500 milliseconds. */
207
        mcapi_struct->status =
208
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
209
                                   mcapi_struct->local_endp, 500,
210
                                   MCAPI_DEFAULT_PRIO);
211
 
212
        /* Wait for the endpoint to be created. */
213
        finished = mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
214
                              MCAPI_FTS_TIMEOUT);
215
 
216
        if ( (finished != MCAPI_TRUE) ||
217
             (mcapi_struct->status != MCAPI_SUCCESS) )
218
        {
219
            mcapi_struct->status = -1;
220
        }
221
 
222
        /* Wait for a response that the creation was successful. */
223
        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
224
 
225
        if (status == MCAPI_SUCCESS)
226
        {
227
            /* Indicate that the endpoint should be deleted. */
228
            status =
229
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
230
                                       mcapi_struct->local_endp, 0,
231
                                       MCAPI_DEFAULT_PRIO);
232
 
233
            if (status == MCAPI_SUCCESS)
234
            {
235
                /* Wait for a response that the endpoint was deleted. */
236
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
237
            }
238
        }
239
    }
240
 
241
    /* Set the state of the test to completed. */
242
    mcapi_struct->state = 0;
243
 
244
    /* Allow the next test to run. */
245
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
246
 
247
} /* MCAPI_FTS_Tx_2_34_3 */
248
 
249
#ifdef LCL_MGMT_UNBROKEN
250
/************************************************************************
251
*
252
*   FUNCTION
253
*
254
*       MCAPI_FTS_Tx_2_34_4
255
*
256
*   DESCRIPTION
257
*
258
*       Testing mcapi_wait while getting a foreign endpoint - endpoint
259
*       retrieved, two requests outstanding
260
*
261
*           Node 0 – Wait for get endpoint request, create endpoint
262
*
263
*           Node 1 – Issue get endpoint request to Node 0, issue a second
264
*                    get from another thread, wait for completion by both
265
*
266
*************************************************************************/
267
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_4)
268
{
269
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
270
    mcapi_endpoint_t    endpoint = 0xffffffff;
271
    size_t              rx_len;
272
    mcapi_status_t      status;
273
    mcapi_boolean_t     finished;
274
 
275
    /* Don't let any other test run while this test is running. */
276
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
277
 
278
    /* Set up the structure for getting the local management server. */
279
    svc_struct.type = MCAPI_MSG_TX_TYPE;
280
    svc_struct.local_port = MCAPI_PORT_ANY;
281
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
282
    svc_struct.service = "lcl_mgmt";
283
    svc_struct.thread_entry = MCAPI_NULL;
284
 
285
    /* Create the client service. */
286
    MCAPID_Create_Service(&svc_struct);
287
 
288
    /* Get the foreign endpoint. */
289
    mcapi_get_endpoint_i(FUNC_BACKEND_NODE_ID, 1024, &endpoint,
290
                         &svc_struct.request, &mcapi_struct->status);
291
 
292
    if (mcapi_struct->status == MCAPI_SUCCESS)
293
    {
294
        /* Indicate that the thread should suspend on the request. */
295
        mcapi_struct->status =
296
            MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_WAIT_REQUEST, 0,
297
                                   svc_struct.local_endp, 0,
298
                                   MCAPI_DEFAULT_PRIO);
299
 
300
        if (mcapi_struct->status == MCAPI_SUCCESS)
301
        {
302
            /* Indicate that the endpoint should be created in 1000 milliseconds. */
303
            mcapi_struct->status =
304
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
305
                                       mcapi_struct->local_endp, 1000,
306
                                       MCAPI_DEFAULT_PRIO);
307
 
308
            if (mcapi_struct->status == MCAPI_SUCCESS)
309
            {
310
                /* Wait for the endpoint to be created. */
311
                finished = mcapi_wait(&svc_struct.request, &rx_len, &mcapi_struct->status,
312
                                      MCAPI_FTS_TIMEOUT);
313
 
314
                if ( (finished != MCAPI_TRUE) ||
315
                     (mcapi_struct->status != MCAPI_SUCCESS) )
316
                {
317
                    mcapi_struct->status = -1;
318
                }
319
 
320
                /* Wait for a response that the wait was successful. */
321
                status = MCAPID_RX_Mgmt_Response(&svc_struct);
322
 
323
                /* Wait for a response that the creation was successful. */
324
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
325
 
326
                if (status == MCAPI_SUCCESS)
327
                {
328
                    /* Indicate that the endpoint should be deleted. */
329
                    status =
330
                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
331
                                               mcapi_struct->local_endp, 0,
332
                                               MCAPI_DEFAULT_PRIO);
333
 
334
                    if (status == MCAPI_SUCCESS)
335
                    {
336
                        /* Wait for a response that the endpoint was deleted. */
337
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
338
                    }
339
                }
340
            }
341
        }
342
    }
343
 
344
    /* Destroy the client service. */
345
    MCAPID_Destroy_Service(&svc_struct, 1);
346
 
347
    /* Set the state of the test to completed. */
348
    mcapi_struct->state = 0;
349
 
350
    /* Allow the next test to run. */
351
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
352
 
353
} /* MCAPI_FTS_Tx_2_34_4 */
354
#endif
355
 
356
/************************************************************************
357
*
358
*   FUNCTION
359
*
360
*       MCAPI_FTS_Tx_2_34_5
361
*
362
*   DESCRIPTION
363
*
364
*       Testing mcapi_wait for completed transmission using
365
*       mcapi_msg_send_i.
366
*
367
*           Node 0 – Create an endpoint, wait for data
368
*
369
*           Node 1 – Issue get endpoint request, transmit data, wait
370
*                    for completed transmission
371
*
372
*************************************************************************/
373
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_5)
374
{
375
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
376
    char                buffer[MCAPID_MSG_LEN];
377
    size_t              rx_len;
378
    mcapi_boolean_t     finished;
379
 
380
    /* Don't let any other test run while this test is running. */
381
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
382
 
383
    /* Store the endpoint to which the other side should reply. */
384
    mcapi_put32((unsigned char*)buffer, MCAPID_MGMT_LOCAL_ENDP_OFFSET, mcapi_struct->local_endp);
385
 
386
    /* Send a message. */
387
    mcapi_msg_send_i(mcapi_struct->local_endp, mcapi_struct->foreign_endp,
388
                     buffer, MCAPID_MSG_LEN, 0, &mcapi_struct->request,
389
                     &mcapi_struct->status);
390
 
391
    /* Wait for a response. */
392
    if (mcapi_struct->status == MCAPI_SUCCESS)
393
    {
394
        /* Test if the data was sent. */
395
        finished = mcapi_wait(&mcapi_struct->request, &rx_len,
396
                              &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
397
 
398
        /* If the test does not return success or the correct number of bytes
399
         * transmitted.
400
         */
401
        if ( (finished != MCAPI_TRUE) ||
402
             (mcapi_struct->status != MCAPI_SUCCESS) ||
403
             (rx_len != MCAPID_MSG_LEN) )
404
        {
405
            mcapi_struct->status = -1;
406
        }
407
    }
408
 
409
    /* Set the state of the test to completed. */
410
    mcapi_struct->state = 0;
411
 
412
    /* Allow the next test to run. */
413
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
414
 
415
} /* MCAPI_FTS_Tx_2_34_5 */
416
 
417
/************************************************************************
418
*
419
*   FUNCTION
420
*
421
*       MCAPI_FTS_Tx_2_34_6
422
*
423
*   DESCRIPTION
424
*
425
*       Testing mcapi_wait receiving data using mcapi_msg_recv_i -
426
*       incomplete.
427
*
428
*           Node 1 – Create endpoint, issue receive request, wait for
429
*                    timeout
430
*
431
*************************************************************************/
432
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_6)
433
{
434
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
435
    char                buffer[MCAPID_MGMT_PKT_LEN];
436
    size_t              rx_len;
437
    mcapi_boolean_t     finished;
438
 
439
    /* Don't let any other test run while this test is running. */
440
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
441
 
442
    /* Make the call to receive the data. */
443
    mcapi_msg_recv_i(mcapi_struct->local_endp, buffer, MCAPID_MGMT_PKT_LEN,
444
                     &mcapi_struct->request, &mcapi_struct->status);
445
 
446
    if (mcapi_struct->status == MCAPI_SUCCESS)
447
    {
448
        /* Wait for the data. */
449
        finished =
450
            mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status, 250);
451
 
452
        if ( (mcapi_struct->status == MCAPI_TIMEOUT) &&
453
             (finished == MCAPI_FALSE) )
454
        {
455
            mcapi_struct->status = MCAPI_SUCCESS;
456
        }
457
 
458
        else
459
        {
460
            mcapi_struct->status = -1;
461
        }
462
    }
463
 
464
    /* Set the state of the test to completed. */
465
    mcapi_struct->state = 0;
466
 
467
    /* Allow the next test to run. */
468
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
469
 
470
} /* MCAPI_FTS_Tx_2_34_6 */
471
 
472
/************************************************************************
473
*
474
*   FUNCTION
475
*
476
*       MCAPI_FTS_Tx_2_34_7
477
*
478
*   DESCRIPTION
479
*
480
*       Testing mcapi_wait receiving data using mcapi_msg_recv_i -
481
*       complete.
482
*
483
*           Node 0 - Create endpoint, wait for other side to issue call
484
*                    to receive data, send data to Node 1.
485
*
486
*           Node 1 – Create endpoint, issue receive request, wait for
487
*                    completion.
488
*
489
*************************************************************************/
490
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_7)
491
{
492
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
493
    char                buffer[MCAPID_MGMT_PKT_LEN];
494
    size_t              rx_len;
495
    mcapi_status_t      status;
496
    mcapi_boolean_t     finished;
497
 
498
    /* Don't let any other test run while this test is running. */
499
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
500
 
501
    /* Indicate that a remote endpoint should be created for sending data
502
     * to this node.
503
     */
504
    mcapi_struct->status =
505
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
506
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
507
 
508
    /* Wait for a response. */
509
    if (mcapi_struct->status == MCAPI_SUCCESS)
510
    {
511
        /* Wait for the response. */
512
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
513
 
514
        /* If the endpoint was created. */
515
        if (mcapi_struct->status == MCAPI_SUCCESS)
516
        {
517
            /* Make the call to receive the data. */
518
            mcapi_msg_recv_i(mcapi_struct->local_endp, buffer, MCAPID_MGMT_PKT_LEN,
519
                             &mcapi_struct->request, &mcapi_struct->status);
520
 
521
            /* Cause the other side to send data. */
522
            mcapi_struct->status =
523
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_NO_OP, 1024,
524
                                       mcapi_struct->local_endp, 1000, MCAPI_DEFAULT_PRIO);
525
 
526
            if (mcapi_struct->status == MCAPI_SUCCESS)
527
            {
528
                /* Wait for the data. */
529
                finished =
530
                    mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
531
 
532
                if ( (finished != MCAPI_TRUE) ||
533
                     (mcapi_struct->status != MCAPI_SUCCESS) )
534
                {
535
                    mcapi_struct->status = -1;
536
                }
537
            }
538
 
539
            /* Tell the other side to delete the endpoint. */
540
            status =
541
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
542
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
543
 
544
            if (status == MCAPI_SUCCESS)
545
            {
546
                /* Wait for the response. */
547
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
548
            }
549
        }
550
    }
551
 
552
    /* Set the state of the test to completed. */
553
    mcapi_struct->state = 0;
554
 
555
    /* Allow the next test to run. */
556
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
557
 
558
} /* MCAPI_FTS_Tx_2_34_7 */
559
 
560
#ifdef LCL_MGMT_UNBROKEN
561
/************************************************************************
562
*
563
*   FUNCTION
564
*
565
*       MCAPI_FTS_Tx_2_34_8
566
*
567
*   DESCRIPTION
568
*
569
*       Testing mcapi_wait receiving data using mcapi_msg_recv_i -
570
*       call canceled.
571
*
572
*           Node 0 - Create endpoint, wait for other side to cancel call
573
*                    to receive data, send data to Node 1.
574
*
575
*           Node 1 – Create endpoint, issue receive request, cancel call,
576
*                    wait for completion.
577
*
578
*************************************************************************/
579
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_8)
580
{
581
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
582
    char                buffer[MCAPID_MGMT_PKT_LEN];
583
    size_t              rx_len;
584
    mcapi_status_t      status;
585
    mcapi_boolean_t     finished;
586
 
587
    /* Don't let any other test run while this test is running. */
588
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
589
 
590
    /* Set up the structure for getting the local management server. */
591
    svc_struct.type = MCAPI_MSG_TX_TYPE;
592
    svc_struct.local_port = MCAPI_PORT_ANY;
593
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
594
    svc_struct.service = "lcl_mgmt";
595
    svc_struct.thread_entry = MCAPI_NULL;
596
 
597
    /* Create the client service. */
598
    MCAPID_Create_Service(&svc_struct);
599
 
600
    /* Indicate that a remote endpoint should be created for sending data
601
     * to this node.
602
     */
603
    mcapi_struct->status =
604
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
605
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
606
 
607
    /* Wait for a response. */
608
    if (mcapi_struct->status == MCAPI_SUCCESS)
609
    {
610
        /* Wait for the response. */
611
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
612
 
613
        /* If the endpoint was created. */
614
        if (mcapi_struct->status == MCAPI_SUCCESS)
615
        {
616
            /* Make the call to receive the data. */
617
            mcapi_msg_recv_i(mcapi_struct->local_endp, buffer, MCAPID_MGMT_PKT_LEN,
618
                             &svc_struct.request, &mcapi_struct->status);
619
 
620
            /* Cause the call to be canceled. */
621
            mcapi_struct->status =
622
                MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
623
                                       svc_struct.local_endp, 1000, MCAPI_DEFAULT_PRIO);
624
 
625
            if (mcapi_struct->status == MCAPI_SUCCESS)
626
            {
627
                /* Wait for the data. */
628
                finished = mcapi_wait(&svc_struct.request, &rx_len,
629
                                      &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
630
 
631
                if ( (finished == MCAPI_FALSE) &&
632
                     (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) )
633
                {
634
                    mcapi_struct->status = MCAPI_SUCCESS;
635
                }
636
 
637
                else
638
                {
639
                    mcapi_struct->status = -1;
640
                }
641
            }
642
 
643
            /* Tell the other side to delete the endpoint. */
644
            status =
645
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
646
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
647
 
648
            if (status == MCAPI_SUCCESS)
649
            {
650
                /* Wait for the response. */
651
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
652
            }
653
        }
654
    }
655
 
656
    /* Destroy the client service. */
657
    MCAPID_Destroy_Service(&svc_struct, 1);
658
 
659
    /* Set the state of the test to completed. */
660
    mcapi_struct->state = 0;
661
 
662
    /* Allow the next test to run. */
663
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
664
 
665
} /* MCAPI_FTS_Tx_2_34_8 */
666
#endif
667
 
668
/************************************************************************
669
*
670
*   FUNCTION
671
*
672
*       MCAPI_FTS_Tx_2_34_9
673
*
674
*   DESCRIPTION
675
*
676
*       Testing mcapi_wait over mcapi_connect_pktchan_i - completed
677
*
678
*           Node 0 – Create an endpoint
679
*
680
*           Node 1 – Create an endpoint, get the endpoint on Node 0, issue
681
*                    connection, wait for completion
682
*
683
*************************************************************************/
684
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_9)
685
{
686
    MCAPID_STRUCT           *mcapi_struct = (MCAPID_STRUCT*)argv;
687
    size_t                  rx_len;
688
    mcapi_status_t          status;
689
    mcapi_endpoint_t        tx_endp, rx_endp;
690
    mcapi_boolean_t         finished;
691
 
692
    /* Don't let any other test run while this test is running. */
693
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
694
 
695
    /* An extra endpoint is required for the test. */
696
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
697
 
698
    if (mcapi_struct->status == MCAPI_SUCCESS)
699
    {
700
        /* Indicate that a remote endpoint should be created. */
701
        mcapi_struct->status =
702
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
703
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
704
 
705
        if (mcapi_struct->status == MCAPI_SUCCESS)
706
        {
707
            /* Wait for a response. */
708
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
709
 
710
            /* If the endpoint was created. */
711
            if (mcapi_struct->status == MCAPI_SUCCESS)
712
            {
713
                /* Get the foreign endpoint. */
714
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
715
 
716
                if (mcapi_struct->status == MCAPI_SUCCESS)
717
                {
718
                    /* Connect the two endpoints. */
719
                    mcapi_connect_pktchan_i(tx_endp, rx_endp,
720
                                            &mcapi_struct->request,
721
                                            &mcapi_struct->status);
722
 
723
                    if (mcapi_struct->status == MCAPI_SUCCESS)
724
                    {
725
                        /* The connect call will return successfully. */
726
                        finished =
727
                            mcapi_wait(&mcapi_struct->request, &rx_len,
728
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
729
 
730
                        if ( (finished != MCAPI_TRUE) ||
731
                             (mcapi_struct->status != MCAPI_SUCCESS) )
732
                        {
733
                            mcapi_struct->status = -1;
734
                        }
735
                    }
736
                }
737
 
738
                /* Tell the other side to delete the endpoint. */
739
                status =
740
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
741
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
742
 
743
                if (status == MCAPI_SUCCESS)
744
                {
745
                    /* Wait for the response. */
746
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
747
                }
748
            }
749
        }
750
 
751
        /* Delete the extra endpoint. */
752
        mcapi_delete_endpoint(rx_endp, &status);
753
    }
754
 
755
    /* Set the state of the test to completed. */
756
    mcapi_struct->state = 0;
757
 
758
    /* Allow the next test to run. */
759
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
760
 
761
} /* MCAPI_FTS_Tx_2_34_9 */
762
 
763
/************************************************************************
764
*
765
*   FUNCTION
766
*
767
*       MCAPI_FTS_Tx_2_34_10
768
*
769
*   DESCRIPTION
770
*
771
*       Testing mcapi_wait over mcapi_open_pktchan_recv_i - timed out
772
*
773
*           Node 1 – Create endpoint, open receive side, wait for
774
*                    open to time out
775
*
776
*************************************************************************/
777
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_10)
778
{
779
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
780
    size_t              rx_len;
781
    mcapi_status_t      status;
782
    mcapi_boolean_t     finished;
783
 
784
    /* Don't let any other test run while this test is running. */
785
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
786
 
787
    /* Open the receive side. */
788
    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
789
                              mcapi_struct->local_endp,
790
                              &mcapi_struct->request,
791
                              &mcapi_struct->status);
792
 
793
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
794
    {
795
        /* Wait for completion to timeout. */
796
        finished = mcapi_wait(&mcapi_struct->request, &rx_len,
797
                              &mcapi_struct->status, 250);
798
 
799
        if ( (mcapi_struct->status == MCAPI_TIMEOUT) &&
800
             (finished == MCAPI_FALSE) )
801
        {
802
            mcapi_struct->status = MCAPI_SUCCESS;
803
        }
804
 
805
        else
806
        {
807
            mcapi_struct->status = -1;
808
        }
809
 
810
        mcapi_cancel(&mcapi_struct->request, &status);
811
    }
812
 
813
    /* Set the state of the test to completed. */
814
    mcapi_struct->state = 0;
815
 
816
    /* Allow the next test to run. */
817
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
818
 
819
} /* MCAPI_FTS_Tx_2_34_10 */
820
 
821
/************************************************************************
822
*
823
*   FUNCTION
824
*
825
*       MCAPI_FTS_Tx_2_34_11
826
*
827
*   DESCRIPTION
828
*
829
*       Testing mcapi_test over mcapi_open_pktchan_recv_i - complete
830
*
831
*           Node 0 - Create endpoint, open send side.
832
*
833
*           Node 1 – Create endpoint, connect, open receive side, wait for
834
*                    completion.
835
*
836
*************************************************************************/
837
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_11)
838
{
839
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
840
    size_t              rx_len;
841
    mcapi_status_t      status;
842
    mcapi_boolean_t     finished;
843
    mcapi_request_t     request;
844
    mcapi_endpoint_t    tx_endp;
845
 
846
    /* Don't let any other test run while this test is running. */
847
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
848
 
849
    /* Indicate that a remote endpoint should be created. */
850
    mcapi_struct->status =
851
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
852
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
853
 
854
    if (mcapi_struct->status == MCAPI_SUCCESS)
855
    {
856
        /* Wait for the response. */
857
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
858
 
859
        /* If the endpoint was created. */
860
        if (mcapi_struct->status == MCAPI_SUCCESS)
861
        {
862
            /* Indicate that the endpoint should be opened as a sender. */
863
            mcapi_struct->status =
864
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
865
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
866
 
867
            /* Wait for the response. */
868
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
869
 
870
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
871
            {
872
                /* Get the foreign endpoint. */
873
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
874
 
875
                if (mcapi_struct->status == MCAPI_SUCCESS)
876
                {
877
                    /* Connect two endpoints. */
878
                    mcapi_connect_pktchan_i(tx_endp, mcapi_struct->local_endp,
879
                                            &mcapi_struct->request,
880
                                            &mcapi_struct->status);
881
 
882
                    if (mcapi_struct->status == MCAPI_SUCCESS)
883
                    {
884
                        /* Open the receive side. */
885
                        mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
886
                                                  mcapi_struct->local_endp,
887
                                                  &request, &mcapi_struct->status);
888
 
889
                        /* Wait for the completion. */
890
                        finished = mcapi_wait(&request, &rx_len, &mcapi_struct->status,
891
                                              MCAPI_FTS_TIMEOUT);
892
 
893
                        if ( (finished != MCAPI_TRUE) ||
894
                             (mcapi_struct->status != MCAPI_SUCCESS) )
895
                        {
896
                            mcapi_struct->status = -1;
897
                        }
898
 
899
                        /* Close the receive side. */
900
                        mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
901
                                                      &request, &status);
902
                    }
903
                }
904
 
905
                /* Tell the other side to close the send side. */
906
                status =
907
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
908
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
909
                                           1024, mcapi_struct->local_endp,
910
                                           0, MCAPI_DEFAULT_PRIO);
911
 
912
                if (status == MCAPI_SUCCESS)
913
                {
914
                    /* Wait for the response. */
915
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
916
                }
917
            }
918
 
919
            /* Tell the other side to delete the endpoint. */
920
            status =
921
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
922
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
923
 
924
            if (status == MCAPI_SUCCESS)
925
            {
926
                /* Wait for the response. */
927
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
928
            }
929
        }
930
    }
931
 
932
    /* Set the state of the test to completed. */
933
    mcapi_struct->state = 0;
934
 
935
    /* Allow the next test to run. */
936
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
937
 
938
} /* MCAPI_FTS_Tx_2_34_11 */
939
 
940
#ifdef LCL_MGMT_UNBROKEN
941
/************************************************************************
942
*
943
*   FUNCTION
944
*
945
*       MCAPI_FTS_Tx_2_34_12
946
*
947
*   DESCRIPTION
948
*
949
*       Testing mcapi_wait over mcapi_open_pktchan_recv_i - canceled
950
*
951
*           Node 1 – Create endpoint, open receive side, cancel, wait for
952
*                    completion.
953
*
954
*************************************************************************/
955
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_12)
956
{
957
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
958
    size_t              rx_len;
959
    mcapi_boolean_t     finished;
960
 
961
    /* Don't let any other test run while this test is running. */
962
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
963
 
964
    /* Set up the structure for getting the local management server. */
965
    svc_struct.type = MCAPI_MSG_TX_TYPE;
966
    svc_struct.local_port = MCAPI_PORT_ANY;
967
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
968
    svc_struct.service = "lcl_mgmt";
969
    svc_struct.thread_entry = MCAPI_NULL;
970
 
971
    /* Create the client service that will cancel the call. */
972
    MCAPID_Create_Service(&svc_struct);
973
 
974
    /* Open the receive side. */
975
    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
976
                              mcapi_struct->local_endp,
977
                              &svc_struct.request,
978
                              &mcapi_struct->status);
979
 
980
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
981
    {
982
        /* Cause the call to be canceled in 1 second. */
983
        mcapi_struct->status =
984
            MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
985
                                   svc_struct.local_endp, 1000, MCAPI_DEFAULT_PRIO);
986
 
987
        if (mcapi_struct->status == MCAPI_SUCCESS)
988
        {
989
            /* Wait for the call to be canceled. */
990
            finished = mcapi_wait(&svc_struct.request, &rx_len,
991
                                  &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
992
 
993
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
994
                 (finished == MCAPI_FALSE) )
995
            {
996
                mcapi_struct->status = MCAPI_SUCCESS;
997
            }
998
 
999
            else
1000
            {
1001
                mcapi_struct->status = -1;
1002
            }
1003
        }
1004
    }
1005
 
1006
    /* Destroy the client service. */
1007
    MCAPID_Destroy_Service(&svc_struct, 1);
1008
 
1009
    /* Set the state of the test to completed. */
1010
    mcapi_struct->state = 0;
1011
 
1012
    /* Allow the next test to run. */
1013
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1014
 
1015
} /* MCAPI_FTS_Tx_2_34_12 */
1016
#endif
1017
 
1018
/************************************************************************
1019
*
1020
*   FUNCTION
1021
*
1022
*       MCAPI_FTS_Tx_2_34_13
1023
*
1024
*   DESCRIPTION
1025
*
1026
*       Testing mcapi_wait over mcapi_open_pktchan_send_i - timed out
1027
*
1028
*           Node 1 – Create endpoint, open send side, wait for
1029
*                    open to time out
1030
*
1031
*************************************************************************/
1032
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_13)
1033
{
1034
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1035
    size_t              rx_len;
1036
    mcapi_status_t      status;
1037
    mcapi_boolean_t     finished;
1038
 
1039
    /* Don't let any other test run while this test is running. */
1040
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1041
 
1042
    /* Open the send side. */
1043
    mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
1044
                              mcapi_struct->local_endp,
1045
                              &mcapi_struct->request,
1046
                              &mcapi_struct->status);
1047
 
1048
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1049
    {
1050
        /* Wait for completion to timeout. */
1051
        finished = mcapi_wait(&mcapi_struct->request, &rx_len,
1052
                              &mcapi_struct->status, 250);
1053
 
1054
        if ( (mcapi_struct->status == MCAPI_TIMEOUT) &&
1055
             (finished == MCAPI_FALSE) )
1056
        {
1057
            mcapi_struct->status = MCAPI_SUCCESS;
1058
        }
1059
 
1060
        else
1061
        {
1062
            mcapi_struct->status = -1;
1063
        }
1064
 
1065
        mcapi_cancel(&mcapi_struct->request, &status);
1066
    }
1067
 
1068
    /* Set the state of the test to completed. */
1069
    mcapi_struct->state = 0;
1070
 
1071
    /* Allow the next test to run. */
1072
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1073
 
1074
} /* MCAPI_FTS_Tx_2_34_13 */
1075
 
1076
/************************************************************************
1077
*
1078
*   FUNCTION
1079
*
1080
*       MCAPI_FTS_Tx_2_34_14
1081
*
1082
*   DESCRIPTION
1083
*
1084
*       Testing mcapi_test over mcapi_open_pktchan_send_i - complete
1085
*
1086
*           Node 0 - Create endpoint, open receive side.
1087
*
1088
*           Node 1 – Create endpoint, connect, open send side, wait for
1089
*                    completion.
1090
*
1091
*************************************************************************/
1092
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_14)
1093
{
1094
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1095
    size_t              rx_len;
1096
    mcapi_status_t      status;
1097
    mcapi_boolean_t     finished;
1098
    mcapi_request_t     request;
1099
    mcapi_endpoint_t    rx_endp;
1100
 
1101
    /* Don't let any other test run while this test is running. */
1102
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1103
 
1104
    /* Indicate that a remote endpoint should be created. */
1105
    mcapi_struct->status =
1106
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1107
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1108
 
1109
    if (mcapi_struct->status == MCAPI_SUCCESS)
1110
    {
1111
        /* Wait for the response. */
1112
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1113
 
1114
        /* If the endpoint was created. */
1115
        if (mcapi_struct->status == MCAPI_SUCCESS)
1116
        {
1117
            /* Indicate that the endpoint should be opened as a receiver. */
1118
            mcapi_struct->status =
1119
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_PKT,
1120
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1121
 
1122
            /* Wait for the response. */
1123
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1124
 
1125
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1126
            {
1127
                /* Get the foreign endpoint. */
1128
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1129
 
1130
                if (mcapi_struct->status == MCAPI_SUCCESS)
1131
                {
1132
                    /* Connect two endpoints. */
1133
                    mcapi_connect_pktchan_i(mcapi_struct->local_endp, rx_endp,
1134
                                            &mcapi_struct->request,
1135
                                            &mcapi_struct->status);
1136
 
1137
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1138
                    {
1139
                        /* Open the send side. */
1140
                        mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
1141
                                                  mcapi_struct->local_endp,
1142
                                                  &request, &mcapi_struct->status);
1143
 
1144
                        /* Wait for the completion. */
1145
                        finished = mcapi_wait(&request, &rx_len, &mcapi_struct->status,
1146
                                              MCAPI_FTS_TIMEOUT);
1147
 
1148
                        if ( (finished != MCAPI_TRUE) ||
1149
                             (mcapi_struct->status != MCAPI_SUCCESS) )
1150
                        {
1151
                            mcapi_struct->status = -1;
1152
                        }
1153
 
1154
                        /* Close the send side. */
1155
                        mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
1156
                                                      &request, &status);
1157
                    }
1158
                }
1159
 
1160
                /* Tell the other side to close the receive side. */
1161
                status =
1162
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
1163
                                           MCAPID_MGMT_CLOSE_RX_SIDE_PKT,
1164
                                           1024, mcapi_struct->local_endp,
1165
                                           0, MCAPI_DEFAULT_PRIO);
1166
 
1167
                if (status == MCAPI_SUCCESS)
1168
                {
1169
                    /* Wait for the response. */
1170
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1171
                }
1172
            }
1173
 
1174
            /* Tell the other side to delete the endpoint. */
1175
            status =
1176
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1177
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1178
 
1179
            if (status == MCAPI_SUCCESS)
1180
            {
1181
                /* Wait for the response. */
1182
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1183
            }
1184
        }
1185
    }
1186
 
1187
    /* Set the state of the test to completed. */
1188
    mcapi_struct->state = 0;
1189
 
1190
    /* Allow the next test to run. */
1191
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1192
 
1193
} /* MCAPI_FTS_Tx_2_34_14 */
1194
 
1195
#ifdef LCL_MGMT_UNBROKEN
1196
/************************************************************************
1197
*
1198
*   FUNCTION
1199
*
1200
*       MCAPI_FTS_Tx_2_34_15
1201
*
1202
*   DESCRIPTION
1203
*
1204
*       Testing mcapi_wait over mcapi_open_pktchan_send_i - canceled
1205
*
1206
*           Node 1 – Create endpoint, open send side, cancel, wait for
1207
*                    completion.
1208
*
1209
*************************************************************************/
1210
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_15)
1211
{
1212
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
1213
    size_t              rx_len;
1214
    mcapi_boolean_t     finished;
1215
 
1216
    /* Don't let any other test run while this test is running. */
1217
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1218
 
1219
    /* Set up the structure for getting the local management server. */
1220
    svc_struct.type = MCAPI_MSG_TX_TYPE;
1221
    svc_struct.local_port = MCAPI_PORT_ANY;
1222
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
1223
    svc_struct.service = "lcl_mgmt";
1224
    svc_struct.thread_entry = MCAPI_NULL;
1225
 
1226
    /* Create the client service that will cancel the call. */
1227
    MCAPID_Create_Service(&svc_struct);
1228
 
1229
    /* Open the send side. */
1230
    mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
1231
                              mcapi_struct->local_endp,
1232
                              &svc_struct.request,
1233
                              &mcapi_struct->status);
1234
 
1235
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1236
    {
1237
        /* Cause the call to be canceled in 1 second. */
1238
        mcapi_struct->status =
1239
            MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
1240
                                   svc_struct.local_endp, 1000, MCAPI_DEFAULT_PRIO);
1241
 
1242
        if (mcapi_struct->status == MCAPI_SUCCESS)
1243
        {
1244
            /* Wait for the call to be canceled. */
1245
            finished = mcapi_wait(&svc_struct.request, &rx_len,
1246
                                  &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1247
 
1248
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
1249
                 (finished == MCAPI_FALSE) )
1250
            {
1251
                mcapi_struct->status = MCAPI_SUCCESS;
1252
            }
1253
 
1254
            else
1255
            {
1256
                mcapi_struct->status = -1;
1257
            }
1258
        }
1259
    }
1260
 
1261
    /* Destroy the client service. */
1262
    MCAPID_Destroy_Service(&svc_struct, 1);
1263
 
1264
    /* Set the state of the test to completed. */
1265
    mcapi_struct->state = 0;
1266
 
1267
    /* Allow the next test to run. */
1268
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1269
 
1270
} /* MCAPI_FTS_Tx_2_34_15 */
1271
#endif
1272
 
1273
/************************************************************************
1274
*
1275
*   FUNCTION
1276
*
1277
*       MCAPI_FTS_Tx_2_34_16
1278
*
1279
*   DESCRIPTION
1280
*
1281
*       Testing mcapi_wait over mcapi_pktchan_send_i - complete
1282
*
1283
*           Node 0 - Create endpoint, open receive side, wait for data.
1284
*
1285
*           Node 1 – Create endpoint, open send side, connect, send data,
1286
*                    wait for completion.
1287
*
1288
*************************************************************************/
1289
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_16)
1290
{
1291
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1292
    size_t              rx_len;
1293
    mcapi_boolean_t     finished;
1294
    char                buffer[MCAPID_MSG_LEN];
1295
    mcapi_status_t      status;
1296
 
1297
    /* Don't let any other test run while this test is running. */
1298
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1299
 
1300
    /* Send some data. */
1301
    mcapi_pktchan_send_i(mcapi_struct->pkt_tx_handle, buffer, MCAPID_MSG_LEN,
1302
                         &mcapi_struct->request, &mcapi_struct->status);
1303
 
1304
    if (mcapi_struct->status == MCAPI_SUCCESS)
1305
    {
1306
        /* Wait for completion. */
1307
        finished = mcapi_wait(&mcapi_struct->request, &rx_len,
1308
                              &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1309
 
1310
        if ( (finished != MCAPI_TRUE) ||
1311
             (mcapi_struct->status != MCAPI_SUCCESS) ||
1312
             (rx_len != MCAPID_MSG_LEN) )
1313
        {
1314
            mcapi_struct->status = -1;
1315
        }
1316
    }
1317
 
1318
    /* Close the send side. */
1319
    mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
1320
                                  &mcapi_struct->request, &status);
1321
 
1322
    /* Set the state of the test to completed. */
1323
    mcapi_struct->state = 0;
1324
 
1325
    /* Allow the next test to run. */
1326
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1327
 
1328
} /* MCAPI_FTS_Tx_2_34_16 */
1329
 
1330
/************************************************************************
1331
*
1332
*   FUNCTION
1333
*
1334
*       MCAPI_FTS_Tx_2_34_17
1335
*
1336
*   DESCRIPTION
1337
*
1338
*       Testing mcapi_wait over mcapi_pktchan_recv_i - timed out
1339
*
1340
*           Node 0 - Create endpoint, open send side.
1341
*
1342
*           Node 1 – Create endpoint, connect, open receive side, issue
1343
*                    receive call, wait for completion.
1344
*
1345
*************************************************************************/
1346
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_17)
1347
{
1348
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1349
    size_t              rx_len;
1350
    mcapi_status_t      status;
1351
    mcapi_boolean_t     finished;
1352
    mcapi_request_t     request;
1353
    mcapi_endpoint_t    tx_endp;
1354
    char                *buffer;
1355
 
1356
    /* Don't let any other test run while this test is running. */
1357
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1358
 
1359
    /* Indicate that a remote endpoint should be created. */
1360
    mcapi_struct->status =
1361
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1362
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1363
 
1364
    if (mcapi_struct->status == MCAPI_SUCCESS)
1365
    {
1366
        /* Wait for the response. */
1367
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1368
 
1369
        /* If the endpoint was created. */
1370
        if (mcapi_struct->status == MCAPI_SUCCESS)
1371
        {
1372
            /* Indicate that the endpoint should be opened as a sender. */
1373
            mcapi_struct->status =
1374
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1375
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1376
 
1377
            /* Wait for the response. */
1378
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1379
 
1380
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1381
            {
1382
                /* Get the foreign endpoint. */
1383
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1384
 
1385
                if (mcapi_struct->status == MCAPI_SUCCESS)
1386
                {
1387
                    /* Connect two endpoints. */
1388
                    mcapi_connect_pktchan_i(tx_endp, mcapi_struct->local_endp,
1389
                                            &mcapi_struct->request,
1390
                                            &mcapi_struct->status);
1391
 
1392
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1393
                    {
1394
                        /* Open the receive side. */
1395
                        mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1396
                                                  mcapi_struct->local_endp,
1397
                                                  &request, &mcapi_struct->status);
1398
 
1399
                        /* Wait for the receive side to open. */
1400
                        mcapi_wait(&request, &rx_len, &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1401
 
1402
                        if (mcapi_struct->status == MCAPI_SUCCESS)
1403
                        {
1404
                            /* Issue a receive call. */
1405
                            mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
1406
                                                 (void**)&buffer, &mcapi_struct->request,
1407
                                                 &mcapi_struct->status);
1408
 
1409
                            if (mcapi_struct->status == MCAPI_SUCCESS)
1410
                            {
1411
                                /* Wait for the completion. */
1412
                                finished = mcapi_wait(&mcapi_struct->request, &rx_len,
1413
                                                      &mcapi_struct->status, 250);
1414
 
1415
                                if ( (finished == MCAPI_FALSE) &&
1416
                                     (mcapi_struct->status == MCAPI_TIMEOUT) )
1417
                                {
1418
                                    mcapi_struct->status = MCAPI_SUCCESS;
1419
                                }
1420
 
1421
                                else
1422
                                {
1423
                                    mcapi_struct->status = -1;
1424
                                }
1425
 
1426
                                /* Cancel the receive call. */
1427
                                mcapi_cancel(&mcapi_struct->request, &status);
1428
                            }
1429
 
1430
                            /* Close the receive side. */
1431
                            mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1432
                                                          &request, &status);
1433
                        }
1434
                    }
1435
                }
1436
 
1437
                /* Tell the other side to close the send side. */
1438
                status =
1439
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
1440
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
1441
                                           1024, mcapi_struct->local_endp,
1442
                                           0, MCAPI_DEFAULT_PRIO);
1443
 
1444
                if (status == MCAPI_SUCCESS)
1445
                {
1446
                    /* Wait for the response. */
1447
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1448
                }
1449
            }
1450
 
1451
            /* Tell the other side to delete the endpoint. */
1452
            status =
1453
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1454
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1455
 
1456
            if (status == MCAPI_SUCCESS)
1457
            {
1458
                /* Wait for the response. */
1459
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1460
            }
1461
        }
1462
    }
1463
 
1464
    /* Set the state of the test to completed. */
1465
    mcapi_struct->state = 0;
1466
 
1467
    /* Allow the next test to run. */
1468
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1469
 
1470
} /* MCAPI_FTS_Tx_2_34_17 */
1471
 
1472
/************************************************************************
1473
*
1474
*   FUNCTION
1475
*
1476
*       MCAPI_FTS_Tx_2_34_18
1477
*
1478
*   DESCRIPTION
1479
*
1480
*       Testing mcapi_wait over mcapi_pktchan_recv_i - complete
1481
*
1482
*           Node 0 - Create endpoint, open send side, send data.
1483
*
1484
*           Node 1 – Create endpoint, connect, open receive side, issue
1485
*                    receive call, wait for completion.
1486
*
1487
*************************************************************************/
1488
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_18)
1489
{
1490
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1491
    size_t              rx_len;
1492
    mcapi_status_t      status;
1493
    mcapi_boolean_t     finished;
1494
    mcapi_request_t     request;
1495
    mcapi_endpoint_t    tx_endp, rx_endp;
1496
    char                *buffer;
1497
 
1498
    /* Don't let any other test run while this test is running. */
1499
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1500
 
1501
    /* This test requires an extra endpoint. */
1502
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
1503
 
1504
    if (mcapi_struct->status == MCAPI_SUCCESS)
1505
    {
1506
        /* Indicate that a remote endpoint should be created. */
1507
        mcapi_struct->status =
1508
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1509
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1510
 
1511
        if (mcapi_struct->status == MCAPI_SUCCESS)
1512
        {
1513
            /* Wait for the response. */
1514
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1515
 
1516
            /* If the endpoint was created. */
1517
            if (mcapi_struct->status == MCAPI_SUCCESS)
1518
            {
1519
                /* Indicate that the endpoint should be opened as a sender. */
1520
                mcapi_struct->status =
1521
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1522
                                           1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1523
 
1524
                /* Wait for the response. */
1525
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1526
 
1527
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1528
                {
1529
                    /* Get the foreign endpoint. */
1530
                    tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1531
 
1532
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1533
                    {
1534
                        /* Connect two endpoints. */
1535
                        mcapi_connect_pktchan_i(tx_endp, rx_endp,
1536
                                                &mcapi_struct->request,
1537
                                                &mcapi_struct->status);
1538
 
1539
                        if (mcapi_struct->status == MCAPI_SUCCESS)
1540
                        {
1541
                            mcapi_wait(&mcapi_struct->request, &rx_len,
1542
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1543
 
1544
                            /* Open the receive side. */
1545
                            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1546
                                                      rx_endp, &request,
1547
                                                      &mcapi_struct->status);
1548
 
1549
                            /* Wait for the receive side to open. */
1550
                            mcapi_wait(&request, &rx_len, &mcapi_struct->status,
1551
                                       MCAPI_FTS_TIMEOUT);
1552
 
1553
                            if (mcapi_struct->status == MCAPI_SUCCESS)
1554
                            {
1555
                                /* Issue a receive call. */
1556
                                mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
1557
                                                     (void**)&buffer,
1558
                                                     &mcapi_struct->request,
1559
                                                     &mcapi_struct->status);
1560
 
1561
                                if (mcapi_struct->status == MCAPI_SUCCESS)
1562
                                {
1563
                                    /* Tell the other side to send some data. */
1564
                                    mcapi_struct->status =
1565
                                        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_TX_PKT,
1566
                                                               1024, mcapi_struct->local_endp,
1567
                                                               1000, MCAPI_DEFAULT_PRIO);
1568
 
1569
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
1570
                                    {
1571
                                        /* Wait for the response. */
1572
                                        mcapi_struct->status =
1573
                                            MCAPID_RX_Mgmt_Response(mcapi_struct);
1574
 
1575
                                        if (mcapi_struct->status == MCAPI_SUCCESS)
1576
                                        {
1577
                                            /* Test for the completion. */
1578
                                            finished = mcapi_wait(&mcapi_struct->request,
1579
                                                                  &rx_len,
1580
                                                                  &mcapi_struct->status,
1581
                                                                  MCAPI_FTS_TIMEOUT);
1582
 
1583
                                            if ( (finished != MCAPI_TRUE) ||
1584
                                                 (mcapi_struct->status != MCAPI_SUCCESS) )
1585
                                            {
1586
                                                mcapi_struct->status = -1;
1587
                                            }
1588
 
1589
                                            /* The buffer must be freed. */
1590
                                            else
1591
                                            {
1592
                                                mcapi_pktchan_free(buffer, &status);
1593
                                            }
1594
                                        }
1595
                                    }
1596
                                }
1597
 
1598
                                /* Close the receive side. */
1599
                                mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1600
                                                              &request, &status);
1601
                            }
1602
                        }
1603
                    }
1604
 
1605
                    /* Tell the other side to close the send side. */
1606
                    status =
1607
                        MCAPID_TX_Mgmt_Message(mcapi_struct,
1608
                                               MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
1609
                                               1024, mcapi_struct->local_endp,
1610
                                               0, MCAPI_DEFAULT_PRIO);
1611
 
1612
                    if (status == MCAPI_SUCCESS)
1613
                    {
1614
                        /* Wait for the response. */
1615
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1616
                    }
1617
                }
1618
 
1619
                /* Tell the other side to delete the endpoint. */
1620
                status =
1621
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1622
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1623
 
1624
                if (status == MCAPI_SUCCESS)
1625
                {
1626
                    /* Wait for the response. */
1627
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1628
                }
1629
            }
1630
        }
1631
 
1632
        /* Delete the extra endpoint. */
1633
        mcapi_delete_endpoint(rx_endp, &status);
1634
    }
1635
 
1636
    /* Set the state of the test to completed. */
1637
    mcapi_struct->state = 0;
1638
 
1639
    /* Allow the next test to run. */
1640
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1641
 
1642
} /* MCAPI_FTS_Tx_2_34_18 */
1643
 
1644
#ifdef LCL_MGMT_UNBROKEN
1645
/************************************************************************
1646
*
1647
*   FUNCTION
1648
*
1649
*       MCAPI_FTS_Tx_2_34_19
1650
*
1651
*   DESCRIPTION
1652
*
1653
*       Testing mcapi_wait over mcapi_pktchan_recv_i - canceled
1654
*
1655
*           Node 0 - Create endpoint, open send side.
1656
*
1657
*           Node 1 – Create endpoint, connect, open receive side, issue
1658
*                    receive call, cancel receive call, wait for completion.
1659
*
1660
*************************************************************************/
1661
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_19)
1662
{
1663
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
1664
    size_t              rx_len;
1665
    mcapi_status_t      status;
1666
    mcapi_boolean_t     finished;
1667
    mcapi_request_t     request;
1668
    mcapi_endpoint_t    tx_endp, rx_endp;
1669
    char                *buffer;
1670
 
1671
    /* Don't let any other test run while this test is running. */
1672
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1673
 
1674
    /* Set up the structure for getting the local management server. */
1675
    svc_struct.type = MCAPI_MSG_TX_TYPE;
1676
    svc_struct.local_port = MCAPI_PORT_ANY;
1677
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
1678
    svc_struct.service = "lcl_mgmt";
1679
    svc_struct.thread_entry = MCAPI_NULL;
1680
 
1681
    /* Create the client service that will cancel the call. */
1682
    MCAPID_Create_Service(&svc_struct);
1683
 
1684
    /* This test requires an extra endpoint. */
1685
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
1686
 
1687
    if (mcapi_struct->status == MCAPI_SUCCESS)
1688
    {
1689
        /* Indicate that a remote endpoint should be created. */
1690
        mcapi_struct->status =
1691
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1692
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1693
 
1694
        if (mcapi_struct->status == MCAPI_SUCCESS)
1695
        {
1696
            /* Wait for the response. */
1697
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1698
 
1699
            /* If the endpoint was created. */
1700
            if (mcapi_struct->status == MCAPI_SUCCESS)
1701
            {
1702
                /* Indicate that the endpoint should be opened as a sender. */
1703
                mcapi_struct->status =
1704
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1705
                                           1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1706
 
1707
                /* Wait for the response. */
1708
                mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1709
 
1710
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1711
                {
1712
                    /* Get the foreign endpoint. */
1713
                    tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
1714
 
1715
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1716
                    {
1717
                        /* Connect two endpoints. */
1718
                        mcapi_connect_pktchan_i(tx_endp, rx_endp,
1719
                                                &mcapi_struct->request,
1720
                                                &mcapi_struct->status);
1721
 
1722
                        if (mcapi_struct->status == MCAPI_SUCCESS)
1723
                        {
1724
                            mcapi_wait(&mcapi_struct->request, &rx_len,
1725
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1726
 
1727
                            /* Open the receive side. */
1728
                            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1729
                                                      rx_endp, &request,
1730
                                                      &mcapi_struct->status);
1731
 
1732
                            /* Wait for the receive side to open. */
1733
                            mcapi_wait(&request, &rx_len, &mcapi_struct->status,
1734
                                       MCAPI_FTS_TIMEOUT);
1735
 
1736
                            if (mcapi_struct->status == MCAPI_SUCCESS)
1737
                            {
1738
                                /* Issue a receive call. */
1739
                                mcapi_pktchan_recv_i(mcapi_struct->pkt_rx_handle,
1740
                                                     (void**)&buffer,
1741
                                                     &svc_struct.request,
1742
                                                     &mcapi_struct->status);
1743
 
1744
                                if (mcapi_struct->status == MCAPI_SUCCESS)
1745
                                {
1746
                                    /* Cause the call to be canceled in 1 second. */
1747
                                    mcapi_struct->status =
1748
                                        MCAPID_TX_Mgmt_Message(&svc_struct,
1749
                                                               MCAPID_CANCEL_REQUEST, 0,
1750
                                                               svc_struct.local_endp, 1000,
1751
                                                               MCAPI_DEFAULT_PRIO);
1752
 
1753
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
1754
                                    {
1755
                                        /* Test for the completion. */
1756
                                        finished = mcapi_wait(&svc_struct.request,
1757
                                                              &rx_len,
1758
                                                              &mcapi_struct->status,
1759
                                                              MCAPI_FTS_TIMEOUT);
1760
 
1761
                                        if ( (finished != MCAPI_FALSE) ||
1762
                                             (mcapi_struct->status != MCAPI_ERR_REQUEST_CANCELLED) )
1763
                                        {
1764
                                            mcapi_struct->status = -1;
1765
                                        }
1766
 
1767
                                        else
1768
                                        {
1769
                                            mcapi_struct->status = MCAPI_SUCCESS;
1770
                                        }
1771
                                    }
1772
                                }
1773
 
1774
                                /* Close the receive side. */
1775
                                mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1776
                                                              &request, &status);
1777
                            }
1778
                        }
1779
                    }
1780
 
1781
                    /* Tell the other side to close the send side. */
1782
                    status =
1783
                        MCAPID_TX_Mgmt_Message(mcapi_struct,
1784
                                               MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
1785
                                               1024, mcapi_struct->local_endp,
1786
                                               0, MCAPI_DEFAULT_PRIO);
1787
 
1788
                    if (status == MCAPI_SUCCESS)
1789
                    {
1790
                        /* Wait for the response. */
1791
                        status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1792
                    }
1793
                }
1794
 
1795
                /* Tell the other side to delete the endpoint. */
1796
                status =
1797
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1798
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1799
 
1800
                if (status == MCAPI_SUCCESS)
1801
                {
1802
                    /* Wait for the response. */
1803
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1804
                }
1805
            }
1806
        }
1807
 
1808
        /* Delete the extra endpoint. */
1809
        mcapi_delete_endpoint(rx_endp, &status);
1810
    }
1811
 
1812
    /* Destroy the client service that will cancel the call. */
1813
    MCAPID_Destroy_Service(&svc_struct, 1);
1814
 
1815
    /* Set the state of the test to completed. */
1816
    mcapi_struct->state = 0;
1817
 
1818
    /* Allow the next test to run. */
1819
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1820
 
1821
} /* MCAPI_FTS_Tx_2_34_19 */
1822
#endif
1823
 
1824
/************************************************************************
1825
*
1826
*   FUNCTION
1827
*
1828
*       MCAPI_FTS_Tx_2_34_20
1829
*
1830
*   DESCRIPTION
1831
*
1832
*       Testing mcapi_wait over mcapi_pktchan_recv_close_i - tx not
1833
*       opened, not connected
1834
*
1835
*           Node 1 – Create endpoint, open receive side, close receive
1836
*                    side, wait for completion
1837
*
1838
*************************************************************************/
1839
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_20)
1840
{
1841
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1842
    size_t              rx_len;
1843
    mcapi_boolean_t     finished;
1844
    mcapi_request_t     request;
1845
 
1846
    /* Don't let any other test run while this test is running. */
1847
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1848
 
1849
    /* Open the receive side. */
1850
    mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1851
                              mcapi_struct->local_endp,
1852
                              &mcapi_struct->request,
1853
                              &mcapi_struct->status);
1854
 
1855
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1856
    {
1857
        /* Close the receive side. */
1858
        mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1859
                                      &request, &mcapi_struct->status);
1860
 
1861
        if (mcapi_struct->status == MCAPI_SUCCESS)
1862
        {
1863
            /* Wait for the completion to time out. */
1864
            finished = mcapi_wait(&request, &rx_len, &mcapi_struct->status,
1865
                                  MCAPI_FTS_TIMEOUT);
1866
 
1867
            if ( (finished != MCAPI_TRUE) ||
1868
                 (mcapi_struct->status != MCAPI_SUCCESS) )
1869
            {
1870
                mcapi_struct->status = -1;
1871
            }
1872
        }
1873
    }
1874
 
1875
    /* Set the state of the test to completed. */
1876
    mcapi_struct->state = 0;
1877
 
1878
    /* Allow the next test to run. */
1879
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1880
 
1881
} /* MCAPI_FTS_Tx_2_34_20 */
1882
 
1883
/************************************************************************
1884
*
1885
*   FUNCTION
1886
*
1887
*       MCAPI_FTS_Tx_2_34_21
1888
*
1889
*   DESCRIPTION
1890
*
1891
*       Testing mcapi_wait over mcapi_pktchan_recv_close_i - tx opened,
1892
*       not connected
1893
*
1894
*           Node 0 - Create endpoint, open send side
1895
*
1896
*           Node 1 – Create endpoint, open receive side, wait for Node 0 to
1897
*                    open send side, wait for completion
1898
*
1899
*************************************************************************/
1900
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_21)
1901
{
1902
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
1903
    size_t              rx_len;
1904
    mcapi_status_t      status;
1905
    mcapi_boolean_t     finished;
1906
    mcapi_request_t     request;
1907
 
1908
    /* Don't let any other test run while this test is running. */
1909
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
1910
 
1911
    /* Indicate that a remote endpoint should be created. */
1912
    mcapi_struct->status =
1913
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
1914
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1915
 
1916
    if (mcapi_struct->status == MCAPI_SUCCESS)
1917
    {
1918
        /* Wait for the response. */
1919
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1920
 
1921
        /* If the endpoint was created. */
1922
        if (mcapi_struct->status == MCAPI_SUCCESS)
1923
        {
1924
            /* Indicate that the endpoint should be opened as a sender. */
1925
            mcapi_struct->status =
1926
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
1927
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1928
 
1929
            /* Wait for the response. */
1930
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1931
 
1932
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1933
            {
1934
                /* Open the receive side. */
1935
                mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
1936
                                          mcapi_struct->local_endp,
1937
                                          &mcapi_struct->request,
1938
                                          &mcapi_struct->status);
1939
 
1940
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
1941
                {
1942
                    /* Close the receive side. */
1943
                    mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
1944
                                                  &request, &mcapi_struct->status);
1945
 
1946
                    if (mcapi_struct->status == MCAPI_SUCCESS)
1947
                    {
1948
                        /* Wait for the completion to time out. */
1949
                        finished = mcapi_wait(&request, &rx_len,
1950
                                              &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
1951
 
1952
                        if ( (finished != MCAPI_TRUE) ||
1953
                             (mcapi_struct->status != MCAPI_SUCCESS) )
1954
                        {
1955
                            mcapi_struct->status = -1;
1956
                        }
1957
                    }
1958
                }
1959
 
1960
                /* Tell the other side to close the send side. */
1961
                status =
1962
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
1963
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
1964
                                           1024, mcapi_struct->local_endp,
1965
                                           0, MCAPI_DEFAULT_PRIO);
1966
 
1967
                if (status == MCAPI_SUCCESS)
1968
                {
1969
                    /* Wait for the response. */
1970
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1971
                }
1972
            }
1973
 
1974
            /* Tell the other side to delete the endpoint. */
1975
            status =
1976
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
1977
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
1978
 
1979
            if (status == MCAPI_SUCCESS)
1980
            {
1981
                /* Wait for the response. */
1982
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
1983
            }
1984
        }
1985
    }
1986
 
1987
    /* Set the state of the test to completed. */
1988
    mcapi_struct->state = 0;
1989
 
1990
    /* Allow the next test to run. */
1991
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
1992
 
1993
} /* MCAPI_FTS_Tx_2_34_21 */
1994
 
1995
/************************************************************************
1996
*
1997
*   FUNCTION
1998
*
1999
*       MCAPI_FTS_Tx_2_34_22
2000
*
2001
*   DESCRIPTION
2002
*
2003
*       Testing mcapi_wait over mcapi_pktchan_recv_close_i - tx opened,
2004
*       connected
2005
*
2006
*           Node 0 - Create endpoint, open send side
2007
*
2008
*           Node 1 – Create endpoint, issue connection, open receive side,
2009
*                    wait for completion.
2010
*
2011
*************************************************************************/
2012
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_22)
2013
{
2014
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2015
    size_t              rx_len;
2016
    mcapi_status_t      status;
2017
    mcapi_boolean_t     finished;
2018
    mcapi_request_t     request;
2019
    mcapi_endpoint_t    tx_endp;
2020
 
2021
    /* Don't let any other test run while this test is running. */
2022
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2023
 
2024
    /* Indicate that a remote endpoint should be created. */
2025
    mcapi_struct->status =
2026
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2027
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2028
 
2029
    if (mcapi_struct->status == MCAPI_SUCCESS)
2030
    {
2031
        /* Wait for the response. */
2032
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2033
 
2034
        /* If the endpoint was created. */
2035
        if (mcapi_struct->status == MCAPI_SUCCESS)
2036
        {
2037
            /* Indicate that the endpoint should be opened as a sender. */
2038
            mcapi_struct->status =
2039
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_PKT,
2040
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2041
 
2042
            /* Wait for the response. */
2043
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2044
 
2045
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2046
            {
2047
                /* Get the send side endpoint. */
2048
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2049
 
2050
                if (mcapi_struct->status == MCAPI_SUCCESS)
2051
                {
2052
                    /* Connect the two endpoints. */
2053
                    mcapi_connect_pktchan_i(tx_endp, mcapi_struct->local_endp,
2054
                                            &mcapi_struct->request,
2055
                                            &mcapi_struct->status);
2056
 
2057
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2058
                    {
2059
                        /* Wait for the connection to open. */
2060
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
2061
                                   MCAPI_FTS_TIMEOUT);
2062
 
2063
                        if (mcapi_struct->status == MCAPI_SUCCESS)
2064
                        {
2065
                            /* Open the receive side. */
2066
                            mcapi_open_pktchan_recv_i(&mcapi_struct->pkt_rx_handle,
2067
                                                      mcapi_struct->local_endp,
2068
                                                      &request, &mcapi_struct->status);
2069
 
2070
                            if (mcapi_struct->status == MCAPI_SUCCESS)
2071
                            {
2072
                                /* Wait for the receive side to open. */
2073
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
2074
                                           MCAPI_FTS_TIMEOUT);
2075
 
2076
                                if (mcapi_struct->status == MCAPI_SUCCESS)
2077
                                {
2078
                                    /* Close the receive side. */
2079
                                    mcapi_packetchan_recv_close_i(mcapi_struct->pkt_rx_handle,
2080
                                                                  &request, &mcapi_struct->status);
2081
 
2082
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
2083
                                    {
2084
                                        /* Test for the completion. */
2085
                                        finished = mcapi_wait(&request, &rx_len,
2086
                                                              &mcapi_struct->status,
2087
                                                              MCAPI_FTS_TIMEOUT);
2088
 
2089
                                        if ( (finished != MCAPI_TRUE) ||
2090
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
2091
                                        {
2092
                                            mcapi_struct->status = -1;
2093
                                        }
2094
                                    }
2095
                                }
2096
                            }
2097
                        }
2098
                    }
2099
                }
2100
 
2101
                /* Tell the other side to close the send side. */
2102
                status =
2103
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2104
                                           MCAPID_MGMT_CLOSE_TX_SIDE_PKT,
2105
                                           1024, mcapi_struct->local_endp,
2106
                                           0, MCAPI_DEFAULT_PRIO);
2107
 
2108
                if (status == MCAPI_SUCCESS)
2109
                {
2110
                    /* Wait for the response. */
2111
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2112
                }
2113
            }
2114
 
2115
            /* Tell the other side to delete the endpoint. */
2116
            status =
2117
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2118
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2119
 
2120
            if (status == MCAPI_SUCCESS)
2121
            {
2122
                /* Wait for the response. */
2123
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2124
            }
2125
        }
2126
    }
2127
 
2128
    /* Set the state of the test to completed. */
2129
    mcapi_struct->state = 0;
2130
 
2131
    /* Allow the next test to run. */
2132
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2133
 
2134
} /* MCAPI_FTS_Tx_2_34_22 */
2135
 
2136
/************************************************************************
2137
*
2138
*   FUNCTION
2139
*
2140
*       MCAPI_FTS_Tx_2_34_23
2141
*
2142
*   DESCRIPTION
2143
*
2144
*       Testing mcapi_test over mcapi_pktchan_send_close_i - rx not
2145
*       opened, not connected
2146
*
2147
*           Node 1 – Create endpoint, open send side, close send
2148
*                    side, wait for completion.
2149
*
2150
*************************************************************************/
2151
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_23)
2152
{
2153
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2154
    size_t              rx_len;
2155
    mcapi_boolean_t     finished;
2156
    mcapi_request_t     request;
2157
 
2158
    /* Don't let any other test run while this test is running. */
2159
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2160
 
2161
    /* Open the send side. */
2162
    mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
2163
                              mcapi_struct->local_endp,
2164
                              &mcapi_struct->request,
2165
                              &mcapi_struct->status);
2166
 
2167
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2168
    {
2169
        /* Close the send side. */
2170
        mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
2171
                                      &request, &mcapi_struct->status);
2172
 
2173
        if (mcapi_struct->status == MCAPI_SUCCESS)
2174
        {
2175
            /* Test for the completion. */
2176
            finished = mcapi_wait(&request, &rx_len, &mcapi_struct->status,
2177
                                  MCAPI_FTS_TIMEOUT);
2178
 
2179
            if ( (finished != MCAPI_TRUE) ||
2180
                 (mcapi_struct->status != MCAPI_SUCCESS) )
2181
            {
2182
                mcapi_struct->status = -1;
2183
            }
2184
        }
2185
    }
2186
 
2187
    /* Set the state of the test to completed. */
2188
    mcapi_struct->state = 0;
2189
 
2190
    /* Allow the next test to run. */
2191
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2192
 
2193
} /* MCAPI_FTS_Tx_2_34_23 */
2194
 
2195
/************************************************************************
2196
*
2197
*   FUNCTION
2198
*
2199
*       MCAPI_FTS_Tx_2_34_24
2200
*
2201
*   DESCRIPTION
2202
*
2203
*       Testing mcapi_test over mcapi_pktchan_send_close_i - rx opened,
2204
*       not connected
2205
*
2206
*           Node 0 - Create endpoint, open receive side
2207
*
2208
*           Node 1 – Create endpoint, open send side, wait for Node 0 to
2209
*                    open receive side, wait for completion.
2210
*
2211
*************************************************************************/
2212
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_24)
2213
{
2214
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2215
    size_t              rx_len;
2216
    mcapi_status_t      status;
2217
    mcapi_boolean_t     finished;
2218
    mcapi_request_t     request;
2219
 
2220
    /* Don't let any other test run while this test is running. */
2221
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2222
 
2223
    /* Indicate that a remote endpoint should be created. */
2224
    mcapi_struct->status =
2225
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2226
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2227
 
2228
    if (mcapi_struct->status == MCAPI_SUCCESS)
2229
    {
2230
        /* Wait for the response. */
2231
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2232
 
2233
        /* If the endpoint was created. */
2234
        if (mcapi_struct->status == MCAPI_SUCCESS)
2235
        {
2236
            /* Indicate that the endpoint should be opened as a receiver. */
2237
            mcapi_struct->status =
2238
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_PKT,
2239
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2240
 
2241
            /* Wait for the response. */
2242
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2243
 
2244
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2245
            {
2246
                /* Open the send side. */
2247
                mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
2248
                                          mcapi_struct->local_endp,
2249
                                          &mcapi_struct->request,
2250
                                          &mcapi_struct->status);
2251
 
2252
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2253
                {
2254
                    /* Close the send side. */
2255
                    mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
2256
                                                  &request, &mcapi_struct->status);
2257
 
2258
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2259
                    {
2260
                        /* Test for the completion. */
2261
                        finished = mcapi_wait(&request, &rx_len,
2262
                                              &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
2263
 
2264
                        if ( (finished != MCAPI_TRUE) ||
2265
                             (mcapi_struct->status != MCAPI_SUCCESS) )
2266
                        {
2267
                            mcapi_struct->status = -1;
2268
                        }
2269
                    }
2270
                }
2271
 
2272
                /* Tell the other side to close the receive side. */
2273
                status =
2274
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2275
                                           MCAPID_MGMT_CLOSE_RX_SIDE_PKT,
2276
                                           1024, mcapi_struct->local_endp,
2277
                                           0, MCAPI_DEFAULT_PRIO);
2278
 
2279
                if (status == MCAPI_SUCCESS)
2280
                {
2281
                    /* Wait for the response. */
2282
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2283
                }
2284
            }
2285
 
2286
            /* Tell the other side to delete the endpoint. */
2287
            status =
2288
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2289
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2290
 
2291
            if (status == MCAPI_SUCCESS)
2292
            {
2293
                /* Wait for the response. */
2294
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2295
            }
2296
        }
2297
    }
2298
 
2299
    /* Set the state of the test to completed. */
2300
    mcapi_struct->state = 0;
2301
 
2302
    /* Allow the next test to run. */
2303
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2304
 
2305
} /* MCAPI_FTS_Tx_2_34_24 */
2306
 
2307
/************************************************************************
2308
*
2309
*   FUNCTION
2310
*
2311
*       MCAPI_FTS_Tx_2_34_25
2312
*
2313
*   DESCRIPTION
2314
*
2315
*       Testing mcapi_test over mcapi_pktchan_send_close_i - rx opened,
2316
*       connected
2317
*
2318
*           Node 0 - Create endpoint, open receive side
2319
*
2320
*           Node 1 – Create endpoint, issue connection, open send side,
2321
*                    wait for completion.
2322
*
2323
*************************************************************************/
2324
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_25)
2325
{
2326
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2327
    size_t              rx_len;
2328
    mcapi_status_t      status;
2329
    mcapi_boolean_t     finished;
2330
    mcapi_request_t     request;
2331
    mcapi_endpoint_t    rx_endp;
2332
 
2333
    /* Don't let any other test run while this test is running. */
2334
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2335
 
2336
    /* Indicate that a remote endpoint should be created. */
2337
    mcapi_struct->status =
2338
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2339
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2340
 
2341
    if (mcapi_struct->status == MCAPI_SUCCESS)
2342
    {
2343
        /* Wait for the response. */
2344
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2345
 
2346
        /* If the endpoint was created. */
2347
        if (mcapi_struct->status == MCAPI_SUCCESS)
2348
        {
2349
            /* Indicate that the endpoint should be opened as a receiver. */
2350
            mcapi_struct->status =
2351
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_PKT,
2352
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2353
 
2354
            /* Wait for the response. */
2355
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2356
 
2357
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2358
            {
2359
                /* Get the receive side endpoint. */
2360
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2361
 
2362
                if (mcapi_struct->status == MCAPI_SUCCESS)
2363
                {
2364
                    /* Connect the two endpoints. */
2365
                    mcapi_connect_pktchan_i(mcapi_struct->local_endp, rx_endp,
2366
                                            &mcapi_struct->request,
2367
                                            &mcapi_struct->status);
2368
 
2369
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2370
                    {
2371
                        /* Wait for the connection to open. */
2372
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
2373
                                   MCAPI_FTS_TIMEOUT);
2374
 
2375
                        if (mcapi_struct->status == MCAPI_SUCCESS)
2376
                        {
2377
                            /* Open the send side. */
2378
                            mcapi_open_pktchan_send_i(&mcapi_struct->pkt_tx_handle,
2379
                                                      mcapi_struct->local_endp,
2380
                                                      &request, &mcapi_struct->status);
2381
 
2382
                            if (mcapi_struct->status == MCAPI_SUCCESS)
2383
                            {
2384
                                /* Wait for the send side to open. */
2385
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
2386
                                           MCAPI_FTS_TIMEOUT);
2387
 
2388
                                if (mcapi_struct->status == MCAPI_SUCCESS)
2389
                                {
2390
                                    /* Close the send side. */
2391
                                    mcapi_packetchan_send_close_i(mcapi_struct->pkt_tx_handle,
2392
                                                                  &request, &mcapi_struct->status);
2393
 
2394
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
2395
                                    {
2396
                                        /* Test for the completion. */
2397
                                        finished = mcapi_wait(&request, &rx_len,
2398
                                                              &mcapi_struct->status,
2399
                                                              MCAPI_FTS_TIMEOUT);
2400
 
2401
                                        if ( (finished != MCAPI_TRUE) ||
2402
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
2403
                                        {
2404
                                            mcapi_struct->status = -1;
2405
                                        }
2406
                                    }
2407
                                }
2408
                            }
2409
                        }
2410
                    }
2411
                }
2412
 
2413
                /* Tell the other side to close the receive side. */
2414
                status =
2415
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2416
                                           MCAPID_MGMT_CLOSE_RX_SIDE_PKT,
2417
                                           1024, mcapi_struct->local_endp,
2418
                                           0, MCAPI_DEFAULT_PRIO);
2419
 
2420
                if (status == MCAPI_SUCCESS)
2421
                {
2422
                    /* Wait for the response. */
2423
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2424
                }
2425
            }
2426
 
2427
            /* Tell the other side to delete the endpoint. */
2428
            status =
2429
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2430
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2431
 
2432
            if (status == MCAPI_SUCCESS)
2433
            {
2434
                /* Wait for the response. */
2435
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2436
            }
2437
        }
2438
    }
2439
 
2440
    /* Set the state of the test to completed. */
2441
    mcapi_struct->state = 0;
2442
 
2443
    /* Allow the next test to run. */
2444
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2445
 
2446
} /* MCAPI_FTS_Tx_2_34_25 */
2447
 
2448
/************************************************************************
2449
*
2450
*   FUNCTION
2451
*
2452
*       MCAPI_FTS_Tx_2_34_26
2453
*
2454
*   DESCRIPTION
2455
*
2456
*       Testing mcapi_wait over mcapi_connect_sclchan_i - completed
2457
*
2458
*           Node 0 – Create an endpoint
2459
*
2460
*           Node 1 – Create an endpoint, get the endpoint on Node 0, issue
2461
*                    connection, wait for completion
2462
*
2463
*************************************************************************/
2464
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_26)
2465
{
2466
    MCAPID_STRUCT           *mcapi_struct = (MCAPID_STRUCT*)argv;
2467
    size_t                  rx_len;
2468
    mcapi_status_t          status;
2469
    mcapi_endpoint_t        tx_endp, rx_endp;
2470
    mcapi_boolean_t         finished;
2471
 
2472
    /* Don't let any other test run while this test is running. */
2473
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2474
 
2475
    /* An extra endpoint is required for the test. */
2476
    rx_endp = mcapi_create_endpoint(MCAPI_PORT_ANY, &mcapi_struct->status);
2477
 
2478
    if (mcapi_struct->status == MCAPI_SUCCESS)
2479
    {
2480
        /* Indicate that a remote endpoint should be created. */
2481
        mcapi_struct->status =
2482
            MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2483
                                   mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2484
 
2485
        if (mcapi_struct->status == MCAPI_SUCCESS)
2486
        {
2487
            /* Wait for a response. */
2488
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2489
 
2490
            /* If the endpoint was created. */
2491
            if (mcapi_struct->status == MCAPI_SUCCESS)
2492
            {
2493
                /* Get the foreign endpoint. */
2494
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2495
 
2496
                if (mcapi_struct->status == MCAPI_SUCCESS)
2497
                {
2498
                    /* Connect the two endpoints. */
2499
                    mcapi_connect_sclchan_i(tx_endp, rx_endp,
2500
                                            &mcapi_struct->request,
2501
                                            &mcapi_struct->status);
2502
 
2503
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2504
                    {
2505
                        /* The connect call will return successfully. */
2506
                        finished =
2507
                            mcapi_wait(&mcapi_struct->request, &rx_len,
2508
                                       &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
2509
 
2510
                        if ( (finished != MCAPI_TRUE) ||
2511
                             (mcapi_struct->status != MCAPI_SUCCESS) )
2512
                        {
2513
                            mcapi_struct->status = -1;
2514
                        }
2515
                    }
2516
                }
2517
 
2518
                /* Tell the other side to delete the endpoint. */
2519
                status =
2520
                    MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2521
                                           mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2522
 
2523
                if (status == MCAPI_SUCCESS)
2524
                {
2525
                    /* Wait for the response. */
2526
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2527
                }
2528
            }
2529
        }
2530
 
2531
        /* Delete the extra endpoint. */
2532
        mcapi_delete_endpoint(rx_endp, &status);
2533
    }
2534
 
2535
    /* Set the state of the test to completed. */
2536
    mcapi_struct->state = 0;
2537
 
2538
    /* Allow the next test to run. */
2539
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2540
 
2541
} /* MCAPI_FTS_Tx_2_34_26 */
2542
 
2543
/************************************************************************
2544
*
2545
*   FUNCTION
2546
*
2547
*       MCAPI_FTS_Tx_2_34_27
2548
*
2549
*   DESCRIPTION
2550
*
2551
*       Testing mcapi_wait over mcapi_open_sclchan_recv_i - timed out
2552
*
2553
*           Node 1 – Create endpoint, open receive side, wait for
2554
*                    open to time out
2555
*
2556
*************************************************************************/
2557
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_27)
2558
{
2559
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2560
    size_t              rx_len;
2561
    mcapi_status_t      status;
2562
    mcapi_boolean_t     finished;
2563
 
2564
    /* Don't let any other test run while this test is running. */
2565
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2566
 
2567
    /* Open the receive side. */
2568
    mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
2569
                              mcapi_struct->local_endp,
2570
                              &mcapi_struct->request,
2571
                              &mcapi_struct->status);
2572
 
2573
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2574
    {
2575
        /* Wait for completion to timeout. */
2576
        finished = mcapi_wait(&mcapi_struct->request, &rx_len,
2577
                              &mcapi_struct->status, 250);
2578
 
2579
        if ( (mcapi_struct->status == MCAPI_TIMEOUT) &&
2580
             (finished == MCAPI_FALSE) )
2581
        {
2582
            mcapi_struct->status = MCAPI_SUCCESS;
2583
        }
2584
 
2585
        else
2586
        {
2587
            mcapi_struct->status = -1;
2588
        }
2589
 
2590
        mcapi_cancel(&mcapi_struct->request, &status);
2591
    }
2592
 
2593
    /* Set the state of the test to completed. */
2594
    mcapi_struct->state = 0;
2595
 
2596
    /* Allow the next test to run. */
2597
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2598
 
2599
} /* MCAPI_FTS_Tx_2_34_27 */
2600
 
2601
/************************************************************************
2602
*
2603
*   FUNCTION
2604
*
2605
*       MCAPI_FTS_Tx_2_34_28
2606
*
2607
*   DESCRIPTION
2608
*
2609
*       Testing mcapi_test over mcapi_open_sclchan_recv_i - complete
2610
*
2611
*           Node 0 - Create endpoint, open send side.
2612
*
2613
*           Node 1 – Create endpoint, connect, open receive side, wait for
2614
*                    completion.
2615
*
2616
*************************************************************************/
2617
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_28)
2618
{
2619
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2620
    size_t              rx_len;
2621
    mcapi_status_t      status;
2622
    mcapi_boolean_t     finished;
2623
    mcapi_request_t     request;
2624
    mcapi_endpoint_t    tx_endp;
2625
 
2626
    /* Don't let any other test run while this test is running. */
2627
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2628
 
2629
    /* Indicate that a remote endpoint should be created. */
2630
    mcapi_struct->status =
2631
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2632
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2633
 
2634
    if (mcapi_struct->status == MCAPI_SUCCESS)
2635
    {
2636
        /* Wait for the response. */
2637
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2638
 
2639
        /* If the endpoint was created. */
2640
        if (mcapi_struct->status == MCAPI_SUCCESS)
2641
        {
2642
            /* Indicate that the endpoint should be opened as a sender. */
2643
            mcapi_struct->status =
2644
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
2645
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2646
 
2647
            /* Wait for the response. */
2648
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2649
 
2650
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2651
            {
2652
                /* Get the foreign endpoint. */
2653
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2654
 
2655
                if (mcapi_struct->status == MCAPI_SUCCESS)
2656
                {
2657
                    /* Connect two endpoints. */
2658
                    mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
2659
                                            &mcapi_struct->request,
2660
                                            &mcapi_struct->status);
2661
 
2662
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2663
                    {
2664
                        /* Open the receive side. */
2665
                        mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
2666
                                                  mcapi_struct->local_endp,
2667
                                                  &request, &mcapi_struct->status);
2668
 
2669
                        /* Wait for the completion. */
2670
                        finished = mcapi_wait(&request, &rx_len, &mcapi_struct->status,
2671
                                              MCAPI_FTS_TIMEOUT);
2672
 
2673
                        if ( (finished != MCAPI_TRUE) ||
2674
                             (mcapi_struct->status != MCAPI_SUCCESS) )
2675
                        {
2676
                            mcapi_struct->status = -1;
2677
                        }
2678
 
2679
                        /* Close the receive side. */
2680
                        mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
2681
                                                   &request, &status);
2682
                    }
2683
                }
2684
 
2685
                /* Tell the other side to close the send side. */
2686
                status =
2687
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2688
                                           MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
2689
                                           1024, mcapi_struct->local_endp,
2690
                                           0, MCAPI_DEFAULT_PRIO);
2691
 
2692
                if (status == MCAPI_SUCCESS)
2693
                {
2694
                    /* Wait for the response. */
2695
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2696
                }
2697
            }
2698
 
2699
            /* Tell the other side to delete the endpoint. */
2700
            status =
2701
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2702
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2703
 
2704
            if (status == MCAPI_SUCCESS)
2705
            {
2706
                /* Wait for the response. */
2707
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2708
            }
2709
        }
2710
    }
2711
 
2712
    /* Set the state of the test to completed. */
2713
    mcapi_struct->state = 0;
2714
 
2715
    /* Allow the next test to run. */
2716
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2717
 
2718
} /* MCAPI_FTS_Tx_2_34_28 */
2719
 
2720
#ifdef LCL_MGMT_UNBROKEN
2721
/************************************************************************
2722
*
2723
*   FUNCTION
2724
*
2725
*       MCAPI_FTS_Tx_2_34_29
2726
*
2727
*   DESCRIPTION
2728
*
2729
*       Testing mcapi_wait over mcapi_open_sclchan_recv_i - canceled
2730
*
2731
*           Node 1 – Create endpoint, open receive side, cancel, wait for
2732
*                    completion.
2733
*
2734
*************************************************************************/
2735
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_29)
2736
{
2737
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
2738
    size_t              rx_len;
2739
    mcapi_boolean_t     finished;
2740
 
2741
    /* Don't let any other test run while this test is running. */
2742
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2743
 
2744
    /* Set up the structure for getting the local management server. */
2745
    svc_struct.type = MCAPI_MSG_TX_TYPE;
2746
    svc_struct.local_port = MCAPI_PORT_ANY;
2747
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
2748
    svc_struct.service = "lcl_mgmt";
2749
    svc_struct.thread_entry = MCAPI_NULL;
2750
 
2751
    /* Create the client service that will cancel the call. */
2752
    MCAPID_Create_Service(&svc_struct);
2753
 
2754
    /* Open the receive side. */
2755
    mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
2756
                              mcapi_struct->local_endp,
2757
                              &svc_struct.request,
2758
                              &mcapi_struct->status);
2759
 
2760
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2761
    {
2762
        /* Cause the call to be canceled in 1 second. */
2763
        mcapi_struct->status =
2764
            MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
2765
                                   svc_struct.local_endp, 1000, MCAPI_DEFAULT_PRIO);
2766
 
2767
        if (mcapi_struct->status == MCAPI_SUCCESS)
2768
        {
2769
            /* Wait for the call to be canceled. */
2770
            finished = mcapi_wait(&svc_struct.request, &rx_len,
2771
                                  &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
2772
 
2773
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
2774
                 (finished == MCAPI_FALSE) )
2775
            {
2776
                mcapi_struct->status = MCAPI_SUCCESS;
2777
            }
2778
 
2779
            else
2780
            {
2781
                mcapi_struct->status = -1;
2782
            }
2783
        }
2784
    }
2785
 
2786
    /* Destroy the client service. */
2787
    MCAPID_Destroy_Service(&svc_struct, 1);
2788
 
2789
    /* Set the state of the test to completed. */
2790
    mcapi_struct->state = 0;
2791
 
2792
    /* Allow the next test to run. */
2793
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2794
 
2795
} /* MCAPI_FTS_Tx_2_34_29 */
2796
#endif
2797
 
2798
/************************************************************************
2799
*
2800
*   FUNCTION
2801
*
2802
*       MCAPI_FTS_Tx_2_34_30
2803
*
2804
*   DESCRIPTION
2805
*
2806
*       Testing mcapi_wait over mcapi_open_sclchan_send_i - timed out
2807
*
2808
*           Node 1 – Create endpoint, open send side, wait for
2809
*                    open to time out
2810
*
2811
*************************************************************************/
2812
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_30)
2813
{
2814
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2815
    size_t              rx_len;
2816
    mcapi_status_t      status;
2817
    mcapi_boolean_t     finished;
2818
 
2819
    /* Don't let any other test run while this test is running. */
2820
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2821
 
2822
    /* Open the send side. */
2823
    mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
2824
                              mcapi_struct->local_endp,
2825
                              &mcapi_struct->request,
2826
                              &mcapi_struct->status);
2827
 
2828
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2829
    {
2830
        /* Wait for completion to timeout. */
2831
        finished = mcapi_wait(&mcapi_struct->request, &rx_len,
2832
                              &mcapi_struct->status, 250);
2833
 
2834
        if ( (mcapi_struct->status == MCAPI_TIMEOUT) &&
2835
             (finished == MCAPI_FALSE) )
2836
        {
2837
            mcapi_struct->status = MCAPI_SUCCESS;
2838
        }
2839
 
2840
        else
2841
        {
2842
            mcapi_struct->status = -1;
2843
        }
2844
 
2845
        mcapi_cancel(&mcapi_struct->request, &status);
2846
    }
2847
 
2848
    /* Set the state of the test to completed. */
2849
    mcapi_struct->state = 0;
2850
 
2851
    /* Allow the next test to run. */
2852
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2853
 
2854
} /* MCAPI_FTS_Tx_2_34_30 */
2855
 
2856
/************************************************************************
2857
*
2858
*   FUNCTION
2859
*
2860
*       MCAPI_FTS_Tx_2_34_31
2861
*
2862
*   DESCRIPTION
2863
*
2864
*       Testing mcapi_test over mcapi_open_sclchan_send_i - complete
2865
*
2866
*           Node 0 - Create endpoint, open receive side.
2867
*
2868
*           Node 1 – Create endpoint, connect, open send side, wait for
2869
*                    completion.
2870
*
2871
*************************************************************************/
2872
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_31)
2873
{
2874
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
2875
    size_t              rx_len;
2876
    mcapi_status_t      status;
2877
    mcapi_boolean_t     finished;
2878
    mcapi_request_t     request;
2879
    mcapi_endpoint_t    rx_endp;
2880
 
2881
    /* Don't let any other test run while this test is running. */
2882
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2883
 
2884
    /* Indicate that a remote endpoint should be created. */
2885
    mcapi_struct->status =
2886
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
2887
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2888
 
2889
    if (mcapi_struct->status == MCAPI_SUCCESS)
2890
    {
2891
        /* Wait for the response. */
2892
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2893
 
2894
        /* If the endpoint was created. */
2895
        if (mcapi_struct->status == MCAPI_SUCCESS)
2896
        {
2897
            /* Indicate that the endpoint should be opened as a receiver. */
2898
            mcapi_struct->status =
2899
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
2900
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2901
 
2902
            /* Wait for the response. */
2903
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2904
 
2905
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
2906
            {
2907
                /* Get the foreign endpoint. */
2908
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
2909
 
2910
                if (mcapi_struct->status == MCAPI_SUCCESS)
2911
                {
2912
                    /* Connect two endpoints. */
2913
                    mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
2914
                                            &mcapi_struct->request,
2915
                                            &mcapi_struct->status);
2916
 
2917
                    if (mcapi_struct->status == MCAPI_SUCCESS)
2918
                    {
2919
                        /* Open the send side. */
2920
                        mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
2921
                                                  mcapi_struct->local_endp,
2922
                                                  &request, &mcapi_struct->status);
2923
 
2924
                        /* Wait for the completion. */
2925
                        finished = mcapi_wait(&request, &rx_len, &mcapi_struct->status,
2926
                                              MCAPI_FTS_TIMEOUT);
2927
 
2928
                        if ( (finished != MCAPI_TRUE) ||
2929
                             (mcapi_struct->status != MCAPI_SUCCESS) )
2930
                        {
2931
                            mcapi_struct->status = -1;
2932
                        }
2933
 
2934
                        /* Close the send side. */
2935
                        mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
2936
                                                   &request, &status);
2937
                    }
2938
                }
2939
 
2940
                /* Tell the other side to close the receive side. */
2941
                status =
2942
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
2943
                                           MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
2944
                                           1024, mcapi_struct->local_endp,
2945
                                           0, MCAPI_DEFAULT_PRIO);
2946
 
2947
                if (status == MCAPI_SUCCESS)
2948
                {
2949
                    /* Wait for the response. */
2950
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2951
                }
2952
            }
2953
 
2954
            /* Tell the other side to delete the endpoint. */
2955
            status =
2956
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
2957
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
2958
 
2959
            if (status == MCAPI_SUCCESS)
2960
            {
2961
                /* Wait for the response. */
2962
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
2963
            }
2964
        }
2965
    }
2966
 
2967
    /* Set the state of the test to completed. */
2968
    mcapi_struct->state = 0;
2969
 
2970
    /* Allow the next test to run. */
2971
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
2972
 
2973
} /* MCAPI_FTS_Tx_2_34_31 */
2974
 
2975
#ifdef LCL_MGMT_UNBROKEN
2976
/************************************************************************
2977
*
2978
*   FUNCTION
2979
*
2980
*       MCAPI_FTS_Tx_2_34_32
2981
*
2982
*   DESCRIPTION
2983
*
2984
*       Testing mcapi_wait over mcapi_open_sclchan_send_i - canceled
2985
*
2986
*           Node 1 – Create endpoint, open send side, cancel, wait for
2987
*                    completion.
2988
*
2989
*************************************************************************/
2990
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_32)
2991
{
2992
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv, svc_struct;
2993
    size_t              rx_len;
2994
    mcapi_boolean_t     finished;
2995
 
2996
    /* Don't let any other test run while this test is running. */
2997
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
2998
 
2999
    /* Set up the structure for getting the local management server. */
3000
    svc_struct.type = MCAPI_MSG_TX_TYPE;
3001
    svc_struct.local_port = MCAPI_PORT_ANY;
3002
    svc_struct.node = FUNC_FRONTEND_NODE_ID;
3003
    svc_struct.service = "lcl_mgmt";
3004
    svc_struct.thread_entry = MCAPI_NULL;
3005
 
3006
    /* Create the client service that will cancel the call. */
3007
    MCAPID_Create_Service(&svc_struct);
3008
 
3009
    /* Open the send side. */
3010
    mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3011
                              mcapi_struct->local_endp,
3012
                              &svc_struct.request,
3013
                              &mcapi_struct->status);
3014
 
3015
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3016
    {
3017
        /* Cause the call to be canceled in 1 second. */
3018
        mcapi_struct->status =
3019
            MCAPID_TX_Mgmt_Message(&svc_struct, MCAPID_CANCEL_REQUEST, 0,
3020
                                   svc_struct.local_endp, 1000, MCAPI_DEFAULT_PRIO);
3021
 
3022
        if (mcapi_struct->status == MCAPI_SUCCESS)
3023
        {
3024
            /* Wait for the call to be canceled. */
3025
            finished = mcapi_wait(&svc_struct.request, &rx_len,
3026
                                  &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
3027
 
3028
            if ( (mcapi_struct->status == MCAPI_ERR_REQUEST_CANCELLED) &&
3029
                 (finished == MCAPI_FALSE) )
3030
            {
3031
                mcapi_struct->status = MCAPI_SUCCESS;
3032
            }
3033
 
3034
            else
3035
            {
3036
                mcapi_struct->status = -1;
3037
            }
3038
        }
3039
    }
3040
 
3041
    /* Destroy the client service. */
3042
    MCAPID_Destroy_Service(&svc_struct, 1);
3043
 
3044
    /* Set the state of the test to completed. */
3045
    mcapi_struct->state = 0;
3046
 
3047
    /* Allow the next test to run. */
3048
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3049
 
3050
} /* MCAPI_FTS_Tx_2_34_32 */
3051
#endif
3052
 
3053
/************************************************************************
3054
*
3055
*   FUNCTION
3056
*
3057
*       MCAPI_FTS_Tx_2_34_33
3058
*
3059
*   DESCRIPTION
3060
*
3061
*       Testing mcapi_wait over mcapi_sclchan_recv_close_i - tx not
3062
*       opened, not connected
3063
*
3064
*           Node 1 – Create endpoint, open receive side, close receive
3065
*                    side, wait for completion
3066
*
3067
*************************************************************************/
3068
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_33)
3069
{
3070
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3071
    size_t              rx_len;
3072
    mcapi_boolean_t     finished;
3073
    mcapi_request_t     request;
3074
 
3075
    /* Don't let any other test run while this test is running. */
3076
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3077
 
3078
    /* Open the receive side. */
3079
    mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
3080
                              mcapi_struct->local_endp,
3081
                              &mcapi_struct->request,
3082
                              &mcapi_struct->status);
3083
 
3084
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3085
    {
3086
        /* Close the receive side. */
3087
        mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
3088
                                   &request, &mcapi_struct->status);
3089
 
3090
        if (mcapi_struct->status == MCAPI_SUCCESS)
3091
        {
3092
            /* Wait for the completion to time out. */
3093
            finished = mcapi_wait(&request, &rx_len, &mcapi_struct->status,
3094
                                  MCAPI_FTS_TIMEOUT);
3095
 
3096
            if ( (finished != MCAPI_TRUE) ||
3097
                 (mcapi_struct->status != MCAPI_SUCCESS) )
3098
            {
3099
                mcapi_struct->status = -1;
3100
            }
3101
        }
3102
    }
3103
 
3104
    /* Set the state of the test to completed. */
3105
    mcapi_struct->state = 0;
3106
 
3107
    /* Allow the next test to run. */
3108
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3109
 
3110
} /* MCAPI_FTS_Tx_2_34_33 */
3111
 
3112
/************************************************************************
3113
*
3114
*   FUNCTION
3115
*
3116
*       MCAPI_FTS_Tx_2_34_34
3117
*
3118
*   DESCRIPTION
3119
*
3120
*       Testing mcapi_wait over mcapi_sclchan_recv_close_i - tx opened,
3121
*       not connected
3122
*
3123
*           Node 0 - Create endpoint, open send side
3124
*
3125
*           Node 1 – Create endpoint, open receive side, wait for Node 0 to
3126
*                    open send side, wait for completion
3127
*
3128
*************************************************************************/
3129
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_34)
3130
{
3131
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3132
    size_t              rx_len;
3133
    mcapi_status_t      status;
3134
    mcapi_boolean_t     finished;
3135
    mcapi_request_t     request;
3136
 
3137
    /* Don't let any other test run while this test is running. */
3138
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3139
 
3140
    /* Indicate that a remote endpoint should be created. */
3141
    mcapi_struct->status =
3142
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3143
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3144
 
3145
    if (mcapi_struct->status == MCAPI_SUCCESS)
3146
    {
3147
        /* Wait for the response. */
3148
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3149
 
3150
        /* If the endpoint was created. */
3151
        if (mcapi_struct->status == MCAPI_SUCCESS)
3152
        {
3153
            /* Indicate that the endpoint should be opened as a sender. */
3154
            mcapi_struct->status =
3155
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
3156
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3157
 
3158
            /* Wait for the response. */
3159
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3160
 
3161
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3162
            {
3163
                /* Open the receive side. */
3164
                mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
3165
                                          mcapi_struct->local_endp,
3166
                                          &mcapi_struct->request,
3167
                                          &mcapi_struct->status);
3168
 
3169
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3170
                {
3171
                    /* Close the receive side. */
3172
                    mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
3173
                                               &request, &mcapi_struct->status);
3174
 
3175
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3176
                    {
3177
                        /* Wait for the completion to time out. */
3178
                        finished = mcapi_wait(&request, &rx_len,
3179
                                              &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
3180
 
3181
                        if ( (finished != MCAPI_TRUE) ||
3182
                             (mcapi_struct->status != MCAPI_SUCCESS) )
3183
                        {
3184
                            mcapi_struct->status = -1;
3185
                        }
3186
                    }
3187
                }
3188
 
3189
                /* Tell the other side to close the send side. */
3190
                status =
3191
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3192
                                           MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
3193
                                           1024, mcapi_struct->local_endp,
3194
                                           0, MCAPI_DEFAULT_PRIO);
3195
 
3196
                if (status == MCAPI_SUCCESS)
3197
                {
3198
                    /* Wait for the response. */
3199
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3200
                }
3201
            }
3202
 
3203
            /* Tell the other side to delete the endpoint. */
3204
            status =
3205
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3206
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3207
 
3208
            if (status == MCAPI_SUCCESS)
3209
            {
3210
                /* Wait for the response. */
3211
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3212
            }
3213
        }
3214
    }
3215
 
3216
    /* Set the state of the test to completed. */
3217
    mcapi_struct->state = 0;
3218
 
3219
    /* Allow the next test to run. */
3220
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3221
 
3222
} /* MCAPI_FTS_Tx_2_34_34 */
3223
 
3224
/************************************************************************
3225
*
3226
*   FUNCTION
3227
*
3228
*       MCAPI_FTS_Tx_2_34_35
3229
*
3230
*   DESCRIPTION
3231
*
3232
*       Testing mcapi_wait over mcapi_pktchan_recv_close_i - tx opened,
3233
*       connected
3234
*
3235
*           Node 0 - Create endpoint, open send side
3236
*
3237
*           Node 1 – Create endpoint, issue connection, open receive side,
3238
*                    wait for completion.
3239
*
3240
*************************************************************************/
3241
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_35)
3242
{
3243
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3244
    size_t              rx_len;
3245
    mcapi_status_t      status;
3246
    mcapi_boolean_t     finished;
3247
    mcapi_request_t     request;
3248
    mcapi_endpoint_t    tx_endp;
3249
 
3250
    /* Don't let any other test run while this test is running. */
3251
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3252
 
3253
    /* Indicate that a remote endpoint should be created. */
3254
    mcapi_struct->status =
3255
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3256
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3257
 
3258
    if (mcapi_struct->status == MCAPI_SUCCESS)
3259
    {
3260
        /* Wait for the response. */
3261
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3262
 
3263
        /* If the endpoint was created. */
3264
        if (mcapi_struct->status == MCAPI_SUCCESS)
3265
        {
3266
            /* Indicate that the endpoint should be opened as a sender. */
3267
            mcapi_struct->status =
3268
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_TX_SIDE_SCL,
3269
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3270
 
3271
            /* Wait for the response. */
3272
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3273
 
3274
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3275
            {
3276
                /* Get the send side endpoint. */
3277
                tx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
3278
 
3279
                if (mcapi_struct->status == MCAPI_SUCCESS)
3280
                {
3281
                    /* Connect the two endpoints. */
3282
                    mcapi_connect_sclchan_i(tx_endp, mcapi_struct->local_endp,
3283
                                            &mcapi_struct->request,
3284
                                            &mcapi_struct->status);
3285
 
3286
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3287
                    {
3288
                        /* Wait for the connection to open. */
3289
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
3290
                                   MCAPI_FTS_TIMEOUT);
3291
 
3292
                        if (mcapi_struct->status == MCAPI_SUCCESS)
3293
                        {
3294
                            /* Open the receive side. */
3295
                            mcapi_open_sclchan_recv_i(&mcapi_struct->scl_rx_handle,
3296
                                                      mcapi_struct->local_endp,
3297
                                                      &request, &mcapi_struct->status);
3298
 
3299
                            if (mcapi_struct->status == MCAPI_SUCCESS)
3300
                            {
3301
                                /* Wait for the receive side to open. */
3302
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
3303
                                           MCAPI_FTS_TIMEOUT);
3304
 
3305
                                if (mcapi_struct->status == MCAPI_SUCCESS)
3306
                                {
3307
                                    /* Close the receive side. */
3308
                                    mcapi_sclchan_recv_close_i(mcapi_struct->scl_rx_handle,
3309
                                                               &request, &mcapi_struct->status);
3310
 
3311
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
3312
                                    {
3313
                                        /* Test for the completion. */
3314
                                        finished = mcapi_wait(&request, &rx_len,
3315
                                                              &mcapi_struct->status,
3316
                                                              MCAPI_FTS_TIMEOUT);
3317
 
3318
                                        if ( (finished != MCAPI_TRUE) ||
3319
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
3320
                                        {
3321
                                            mcapi_struct->status = -1;
3322
                                        }
3323
                                    }
3324
                                }
3325
                            }
3326
                        }
3327
                    }
3328
                }
3329
 
3330
                /* Tell the other side to close the send side. */
3331
                status =
3332
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3333
                                           MCAPID_MGMT_CLOSE_TX_SIDE_SCL,
3334
                                           1024, mcapi_struct->local_endp,
3335
                                           0, MCAPI_DEFAULT_PRIO);
3336
 
3337
                if (status == MCAPI_SUCCESS)
3338
                {
3339
                    /* Wait for the response. */
3340
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3341
                }
3342
            }
3343
 
3344
            /* Tell the other side to delete the endpoint. */
3345
            status =
3346
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3347
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3348
 
3349
            if (status == MCAPI_SUCCESS)
3350
            {
3351
                /* Wait for the response. */
3352
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3353
            }
3354
        }
3355
    }
3356
 
3357
    /* Set the state of the test to completed. */
3358
    mcapi_struct->state = 0;
3359
 
3360
    /* Allow the next test to run. */
3361
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3362
 
3363
} /* MCAPI_FTS_Tx_2_34_35 */
3364
 
3365
/************************************************************************
3366
*
3367
*   FUNCTION
3368
*
3369
*       MCAPI_FTS_Tx_2_34_36
3370
*
3371
*   DESCRIPTION
3372
*
3373
*       Testing mcapi_wait over mcapi_sclchan_send_close_i - rx not
3374
*       opened, not connected
3375
*
3376
*           Node 1 – Create endpoint, open send side, close send
3377
*                    side, wait for completion.
3378
*
3379
*************************************************************************/
3380
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_36)
3381
{
3382
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3383
    size_t              rx_len;
3384
    mcapi_boolean_t     finished;
3385
    mcapi_request_t     request;
3386
 
3387
    /* Don't let any other test run while this test is running. */
3388
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3389
 
3390
    /* Open the send side. */
3391
    mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3392
                              mcapi_struct->local_endp,
3393
                              &mcapi_struct->request,
3394
                              &mcapi_struct->status);
3395
 
3396
    if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3397
    {
3398
        /* Close the send side. */
3399
        mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
3400
                                   &request, &mcapi_struct->status);
3401
 
3402
        if (mcapi_struct->status == MCAPI_SUCCESS)
3403
        {
3404
            /* Test for the completion. */
3405
            finished = mcapi_wait(&request, &rx_len, &mcapi_struct->status,
3406
                                  MCAPI_FTS_TIMEOUT);
3407
 
3408
            if ( (finished != MCAPI_TRUE) ||
3409
                 (mcapi_struct->status != MCAPI_SUCCESS) )
3410
            {
3411
                mcapi_struct->status = -1;
3412
            }
3413
        }
3414
    }
3415
 
3416
    /* Set the state of the test to completed. */
3417
    mcapi_struct->state = 0;
3418
 
3419
    /* Allow the next test to run. */
3420
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3421
 
3422
} /* MCAPI_FTS_Tx_2_34_36 */
3423
 
3424
/************************************************************************
3425
*
3426
*   FUNCTION
3427
*
3428
*       MCAPI_FTS_Tx_2_34_37
3429
*
3430
*   DESCRIPTION
3431
*
3432
*       Testing mcapi_wait over mcapi_sclchan_send_close_i - rx opened,
3433
*       not connected
3434
*
3435
*           Node 0 - Create endpoint, open receive side
3436
*
3437
*           Node 1 – Create endpoint, open send side, wait for Node 0 to
3438
*                    open receive side, wait for completion.
3439
*
3440
*************************************************************************/
3441
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_37)
3442
{
3443
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3444
    size_t              rx_len;
3445
    mcapi_status_t      status;
3446
    mcapi_boolean_t     finished;
3447
    mcapi_request_t     request;
3448
 
3449
    /* Don't let any other test run while this test is running. */
3450
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3451
 
3452
    /* Indicate that a remote endpoint should be created. */
3453
    mcapi_struct->status =
3454
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3455
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3456
 
3457
    if (mcapi_struct->status == MCAPI_SUCCESS)
3458
    {
3459
        /* Wait for the response. */
3460
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3461
 
3462
        /* If the endpoint was created. */
3463
        if (mcapi_struct->status == MCAPI_SUCCESS)
3464
        {
3465
            /* Indicate that the endpoint should be opened as a receiver. */
3466
            mcapi_struct->status =
3467
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
3468
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3469
 
3470
            /* Wait for the response. */
3471
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3472
 
3473
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3474
            {
3475
                /* Open the send side. */
3476
                mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3477
                                          mcapi_struct->local_endp,
3478
                                          &mcapi_struct->request,
3479
                                          &mcapi_struct->status);
3480
 
3481
                if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3482
                {
3483
                    /* Close the send side. */
3484
                    mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
3485
                                               &request, &mcapi_struct->status);
3486
 
3487
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3488
                    {
3489
                        /* Test for the completion. */
3490
                        finished = mcapi_wait(&request, &rx_len,
3491
                                              &mcapi_struct->status, MCAPI_FTS_TIMEOUT);
3492
 
3493
                        if ( (finished != MCAPI_TRUE) ||
3494
                             (mcapi_struct->status != MCAPI_SUCCESS) )
3495
                        {
3496
                            mcapi_struct->status = -1;
3497
                        }
3498
                    }
3499
                }
3500
 
3501
                /* Tell the other side to close the receive side. */
3502
                status =
3503
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3504
                                           MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
3505
                                           1024, mcapi_struct->local_endp,
3506
                                           0, MCAPI_DEFAULT_PRIO);
3507
 
3508
                if (status == MCAPI_SUCCESS)
3509
                {
3510
                    /* Wait for the response. */
3511
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3512
                }
3513
            }
3514
 
3515
            /* Tell the other side to delete the endpoint. */
3516
            status =
3517
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3518
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3519
 
3520
            if (status == MCAPI_SUCCESS)
3521
            {
3522
                /* Wait for the response. */
3523
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3524
            }
3525
        }
3526
    }
3527
 
3528
    /* Set the state of the test to completed. */
3529
    mcapi_struct->state = 0;
3530
 
3531
    /* Allow the next test to run. */
3532
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3533
 
3534
} /* MCAPI_FTS_Tx_2_34_37 */
3535
 
3536
/************************************************************************
3537
*
3538
*   FUNCTION
3539
*
3540
*       MCAPI_FTS_Tx_2_34_38
3541
*
3542
*   DESCRIPTION
3543
*
3544
*       Testing mcapi_wait over mcapi_sclchan_send_close_i - rx opened,
3545
*       connected
3546
*
3547
*           Node 0 - Create endpoint, open receive side
3548
*
3549
*           Node 1 – Create endpoint, issue connection, open send side,
3550
*                    wait for completion.
3551
*
3552
*************************************************************************/
3553
MCAPI_THREAD_ENTRY(MCAPI_FTS_Tx_2_34_38)
3554
{
3555
    MCAPID_STRUCT       *mcapi_struct = (MCAPID_STRUCT*)argv;
3556
    size_t              rx_len;
3557
    mcapi_status_t      status;
3558
    mcapi_boolean_t     finished;
3559
    mcapi_request_t     request;
3560
    mcapi_endpoint_t    rx_endp;
3561
 
3562
    /* Don't let any other test run while this test is running. */
3563
    MCAPI_Obtain_Mutex(&MCAPID_FTS_Mutex);
3564
 
3565
    /* Indicate that a remote endpoint should be created. */
3566
    mcapi_struct->status =
3567
        MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_CREATE_ENDP, 1024,
3568
                               mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3569
 
3570
    if (mcapi_struct->status == MCAPI_SUCCESS)
3571
    {
3572
        /* Wait for the response. */
3573
        mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3574
 
3575
        /* If the endpoint was created. */
3576
        if (mcapi_struct->status == MCAPI_SUCCESS)
3577
        {
3578
            /* Indicate that the endpoint should be opened as a receiver. */
3579
            mcapi_struct->status =
3580
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_OPEN_RX_SIDE_SCL,
3581
                                       1024, mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3582
 
3583
            /* Wait for the response. */
3584
            mcapi_struct->status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3585
 
3586
            if (mcapi_struct->status == MGC_MCAPI_ERR_NOT_CONNECTED)
3587
            {
3588
                /* Get the receive side endpoint. */
3589
                rx_endp = mcapi_get_endpoint(FUNC_BACKEND_NODE_ID, 1024, &mcapi_struct->status);
3590
 
3591
                if (mcapi_struct->status == MCAPI_SUCCESS)
3592
                {
3593
                    /* Connect the two endpoints. */
3594
                    mcapi_connect_sclchan_i(mcapi_struct->local_endp, rx_endp,
3595
                                            &mcapi_struct->request,
3596
                                            &mcapi_struct->status);
3597
 
3598
                    if (mcapi_struct->status == MCAPI_SUCCESS)
3599
                    {
3600
                        /* Wait for the connection to open. */
3601
                        mcapi_wait(&mcapi_struct->request, &rx_len, &mcapi_struct->status,
3602
                                   MCAPI_FTS_TIMEOUT);
3603
 
3604
                        if (mcapi_struct->status == MCAPI_SUCCESS)
3605
                        {
3606
                            /* Open the send side. */
3607
                            mcapi_open_sclchan_send_i(&mcapi_struct->scl_tx_handle,
3608
                                                      mcapi_struct->local_endp,
3609
                                                      &request, &mcapi_struct->status);
3610
 
3611
                            if (mcapi_struct->status == MCAPI_SUCCESS)
3612
                            {
3613
                                /* Wait for the send side to open. */
3614
                                mcapi_wait(&request, &rx_len, &mcapi_struct->status,
3615
                                           MCAPI_FTS_TIMEOUT);
3616
 
3617
                                if (mcapi_struct->status == MCAPI_SUCCESS)
3618
                                {
3619
                                    /* Close the send side. */
3620
                                    mcapi_sclchan_send_close_i(mcapi_struct->scl_tx_handle,
3621
                                                               &request, &mcapi_struct->status);
3622
 
3623
                                    if (mcapi_struct->status == MCAPI_SUCCESS)
3624
                                    {
3625
                                        /* Test for the completion. */
3626
                                        finished = mcapi_wait(&request, &rx_len,
3627
                                                              &mcapi_struct->status,
3628
                                                              MCAPI_FTS_TIMEOUT);
3629
 
3630
                                        if ( (finished != MCAPI_TRUE) ||
3631
                                             (mcapi_struct->status != MCAPI_SUCCESS) )
3632
                                        {
3633
                                            mcapi_struct->status = -1;
3634
                                        }
3635
                                    }
3636
                                }
3637
                            }
3638
                        }
3639
                    }
3640
                }
3641
 
3642
                /* Tell the other side to close the receive side. */
3643
                status =
3644
                    MCAPID_TX_Mgmt_Message(mcapi_struct,
3645
                                           MCAPID_MGMT_CLOSE_RX_SIDE_SCL,
3646
                                           1024, mcapi_struct->local_endp,
3647
                                           0, MCAPI_DEFAULT_PRIO);
3648
 
3649
                if (status == MCAPI_SUCCESS)
3650
                {
3651
                    /* Wait for the response. */
3652
                    status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3653
                }
3654
            }
3655
 
3656
            /* Tell the other side to delete the endpoint. */
3657
            status =
3658
                MCAPID_TX_Mgmt_Message(mcapi_struct, MCAPID_MGMT_DELETE_ENDP, 1024,
3659
                                       mcapi_struct->local_endp, 0, MCAPI_DEFAULT_PRIO);
3660
 
3661
            if (status == MCAPI_SUCCESS)
3662
            {
3663
                /* Wait for the response. */
3664
                status = MCAPID_RX_Mgmt_Response(mcapi_struct);
3665
            }
3666
        }
3667
    }
3668
 
3669
    /* Set the state of the test to completed. */
3670
    mcapi_struct->state = 0;
3671
 
3672
    /* Allow the next test to run. */
3673
    MCAPI_Release_Mutex(&MCAPID_FTS_Mutex);
3674
 
3675
} /* MCAPI_FTS_Tx_2_34_38 */

powered by: WebSVN 2.1.0

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