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 2006 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
29 */
30
31 /*
32 *
33 * MODULE: dapl_ep_query.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_query.c,v 1.8 2003/08/20 13:22:05 sjs2 Exp $
40 */
41
42 #include "dapl.h"
43 #include "dapl_adapter_util.h"
44
45 /*
46 * dapl_ep_query
47 *
48 * DAPL Requirements Version xxx, 6.5.5
49 *
50 * Provide the consumer parameters, including attributes and status of
51 * the Endpoint.
52 *
53 * Input:
54 * ep_handle
55 * ep_param_mask
56 *
57 * Output:
58 * ep_param
59 *
60 * Returns:
61 * DAT_SUCCESS
62 * DAT_INVALID_PARAMETER
63 */
64 DAT_RETURN
dapl_ep_query(IN DAT_EP_HANDLE ep_handle,IN DAT_EP_PARAM_MASK ep_param_mask,OUT DAT_EP_PARAM * ep_param)65 dapl_ep_query(
66 IN DAT_EP_HANDLE ep_handle,
67 IN DAT_EP_PARAM_MASK ep_param_mask,
68 OUT DAT_EP_PARAM *ep_param)
69 {
70 DAPL_EP *ep_ptr;
71 DAT_RETURN dat_status;
72
73 dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_ep_query (%p, %x, %p)\n",
74 ep_handle, ep_param_mask, ep_param);
75
76 dat_status = DAT_SUCCESS;
77 ep_ptr = (DAPL_EP *) ep_handle;
78
79 /*
80 * Verify parameter & state
81 */
82 if (DAPL_BAD_HANDLE(ep_ptr, DAPL_MAGIC_EP)) {
83 dat_status = DAT_ERROR(DAT_INVALID_HANDLE,
84 DAT_INVALID_HANDLE_EP);
85 goto bail;
86 }
87
88 if (ep_param == NULL) {
89 dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
90 goto bail;
91 }
92
93 /*
94 * Fill in according to user request
95 *
96 * N.B. Just slam all values into the user structure, there
97 * is nothing to be gained by checking for each bit.
98 */
99 if (ep_param_mask & DAT_EP_FIELD_ALL) {
100 if (ep_ptr->param.ep_state == DAT_EP_STATE_CONNECTED) {
101 /* obtain the remote IP address */
102 dat_status = dapls_ib_cm_remote_addr(
103 (DAT_HANDLE)ep_handle, NULL,
104 &ep_ptr->remote_ia_address);
105 }
106 *ep_param = ep_ptr->param;
107 }
108
109 bail:
110 return (dat_status);
111 }
112