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 2004 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 /*
32  *
33  * MODULE: dapl_psp_query.c
34  *
35  * PURPOSE: Connection management
36  * Description: Interfaces in this file are completely described in
37  *		the DAPL 1.1 API, Chapter 6, section 4
38  *
39  * $Id: dapl_psp_query.c,v 1.8 2003/06/23 12:28:05 sjs2 Exp $
40  */
41 
42 #include "dapl.h"
43 
44 /*
45  * dapl_psp_query
46  *
47  * uDAPL: User Direct Access Program Library Version 1.1, 6.4.1.3
48  *
49  * Provide arguments of the public service points
50  *
51  * Input:
52  *	psp_handle
53  *	psp_args_mask
54  *
55  * Output:
56  * 	psp_args
57  *
58  * Returns:
59  *	DAT_SUCCESS
60  *	DAT_INVALID_PARAMETER
61  */
62 DAT_RETURN
dapl_psp_query(IN DAT_PSP_HANDLE psp_handle,IN DAT_PSP_PARAM_MASK psp_args_mask,OUT DAT_PSP_PARAM * psp_param)63 dapl_psp_query(
64 	IN DAT_PSP_HANDLE psp_handle,
65 	IN DAT_PSP_PARAM_MASK psp_args_mask,
66 	OUT DAT_PSP_PARAM *psp_param)
67 {
68 	DAPL_SP	*sp_ptr;
69 	DAT_RETURN dat_status;
70 
71 	dat_status = DAT_SUCCESS;
72 
73 	if (DAPL_BAD_HANDLE(psp_handle, DAPL_MAGIC_PSP) ||
74 	    ((DAPL_SP *)psp_handle)->listening != DAT_TRUE) {
75 		dat_status = DAT_ERROR(DAT_INVALID_HANDLE,
76 		    DAT_INVALID_HANDLE_PSP);
77 		goto bail;
78 	}
79 
80 	if (NULL == psp_param) {
81 		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
82 		goto bail;
83 	}
84 
85 	/* check for invalid psp param mask */
86 	if (psp_args_mask & ~DAT_PSP_FIELD_ALL) {
87 		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);
88 	}
89 
90 	sp_ptr = (DAPL_SP *) psp_handle;
91 
92 	/*
93 	 * Fill in the PSP params
94 	 */
95 	psp_param->ia_handle   = sp_ptr->ia_handle;
96 	psp_param->conn_qual   = sp_ptr->conn_qual;
97 	psp_param->evd_handle  = sp_ptr->evd_handle;
98 	psp_param->psp_flags   = sp_ptr->psp_flags;
99 
100 bail:
101 	return (dat_status);
102 }
103