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_evd_post_se.c
34  *
35  * PURPOSE: Event Management
36  *
37  * Description: Interfaces in this file are completely defined in
38  *              the uDAPL 1.1 API, Chapter 6, section 3
39  *
40  * $Id: dapl_evd_post_se.c,v 1.7 2003/06/16 17:53:32 sjs2 Exp $
41  */
42 
43 #include "dapl.h"
44 #include "dapl_evd_util.h"
45 #include "dapl_ia_util.h"
46 
47 /*
48  * dapl_evd_post_se
49  *
50  * DAPL Requirements Version xxx, 6.3.2.7
51  *
52  * Post a software event to the Event Dispatcher event queue.
53  *
54  * Input:
55  * 	evd_handle
56  * 	event
57  * Output:
58  * 	none
59  *
60  * Returns:
61  * 	DAT_SUCCESS
62  * 	DAT_INVALID_PARAMETER
63  */
64 
65 
66 DAT_RETURN
dapl_evd_post_se(DAT_EVD_HANDLE evd_handle,const DAT_EVENT * event)67 dapl_evd_post_se(
68 	DAT_EVD_HANDLE		evd_handle,
69 	const DAT_EVENT		*event)
70 {
71 	DAPL_EVD	*evd_ptr;
72 	DAT_RETURN	dat_status;
73 
74 	evd_ptr = (DAPL_EVD *)evd_handle;
75 	dat_status = DAT_SUCCESS;
76 
77 	if (DAPL_BAD_HANDLE(evd_handle, DAPL_MAGIC_EVD)) {
78 		dat_status = DAT_ERROR(DAT_INVALID_HANDLE, 0);
79 		goto bail;
80 	}
81 	/* Only post to EVDs that are specific to software events */
82 	if (!(evd_ptr->evd_flags & DAT_EVD_SOFTWARE_FLAG)) {
83 		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG1);
84 		goto bail;
85 	}
86 
87 	if (!event) {
88 		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);
89 		goto bail;
90 	}
91 	if (event->event_number != DAT_SOFTWARE_EVENT) {
92 			dat_status = DAT_ERROR(DAT_INVALID_PARAMETER,
93 			    DAT_INVALID_ARG2);
94 			goto bail;
95 	}
96 
97 	dat_status = dapls_evd_post_software_event(
98 	    evd_ptr,
99 	    DAT_SOFTWARE_EVENT,
100 	    event->event_data.software_event_data.pointer);
101 bail:
102 	return (dat_status);
103 }
104