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