1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
24 */
25
26 /*
27 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
29 */
30
31 /*
32 *
33 * MODULE: dapl_ep_get_status.c
34 *
35 * PURPOSE: Endpoint management
36 * Description: Interfaces in this file are completely described in
37 * the DAPL 1.1 API, Chapter 6, section 5
38 *
39 * $Id: dapl_ep_get_status.c,v 1.9 2003/07/30 18:13:37 hobie16 Exp $
40 */
41
42 #include "dapl.h"
43 #include "dapl_ring_buffer_util.h"
44
45 /*
46 * dapl_ep_get_status
47 *
48 * DAPL Requirements Version xxx, 6.5.4
49 *
50 * Provide the consumer with a quick snapshot of the Endpoint.
51 * The snapshot consists of Endpoint state and DTO information.
52 *
53 * Input:
54 * ep_handle
55 *
56 * Output:
57 * ep_state
58 * in_dto_idle
59 * out_dto_idle
60 *
61 * Returns:
62 * DAT_SUCCESS
63 * DAT_INVALID_PARAMETER
64 */
65
66 DAT_RETURN
dapl_ep_get_status(IN DAT_EP_HANDLE ep_handle,OUT DAT_EP_STATE * ep_state,OUT DAT_BOOLEAN * in_dto_idle,OUT DAT_BOOLEAN * out_dto_idle)67 dapl_ep_get_status(
68 IN DAT_EP_HANDLE ep_handle,
69 OUT DAT_EP_STATE *ep_state,
70 OUT DAT_BOOLEAN *in_dto_idle,
71 OUT DAT_BOOLEAN *out_dto_idle)
72 {
73 DAPL_EP *ep_ptr;
74 DAT_RETURN dat_status;
75
76 dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_ep_get_status (%p, %p, %p, %p)\n",
77 ep_handle, ep_state, in_dto_idle, out_dto_idle);
78
79 ep_ptr = (DAPL_EP *)ep_handle;
80 dat_status = DAT_SUCCESS;
81
82 /*
83 * Verify parameter & state
84 */
85 if (DAPL_BAD_HANDLE(ep_ptr, DAPL_MAGIC_EP)) {
86 dat_status = DAT_ERROR(DAT_INVALID_HANDLE,
87 DAT_INVALID_HANDLE_EP);
88 goto bail;
89 }
90
91 /*
92 * Gather state info for user
93 */
94 if (ep_state != NULL) {
95 *ep_state = ep_ptr->param.ep_state;
96 }
97
98 if (in_dto_idle != NULL) {
99 *in_dto_idle = (ep_ptr->recv_count) ? DAT_FALSE : DAT_TRUE;
100 }
101
102 if (out_dto_idle != NULL) {
103 *out_dto_idle = (ep_ptr->req_count) ? DAT_FALSE : DAT_TRUE;
104 }
105
106 bail:
107 return (dat_status);
108 }
109