xref: /illumos-gate/usr/src/lib/libtsalarm/common/tsalarm.h (revision 581cede61ac9c14d8d4ea452562a567189eead78)
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_TSALARM_H
27 #define	_TSALARM_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /* alarm_action */
36 #define	TSALARM_ENABLE		1
37 #define	TSALARM_DISABLE		2
38 #define	TSALARM_STATUS		3
39 
40 /* alarm_id */
41 #define	TSALARM_CRITICAL	0
42 #define	TSALARM_MAJOR		1
43 #define	TSALARM_MINOR		2
44 #define	TSALARM_USER		3
45 
46 /* alarm_state */
47 #define	TSALARM_STATE_ON	1
48 #define	TSALARM_STATE_OFF	2
49 #define	TSALARM_STATE_UNKNOWN	3
50 
51 /* Status Types */
52 #define	TSALARM_OK		1
53 #define	TSALARM_ERROR		2
54 
55 /* Error codes */
56 #define	TSALARM_SUCCESS			0
57 #define	TSALARM_CHANNEL_INIT_FAILURE	-1
58 #define	TSALARM_NULL_REQ_DATA		-2
59 #define	TSALARM_COMM_FAILURE		-3
60 #define	TSALARM_UNBOUND_PACKET_RECVD	-4
61 #define	TSALARM_GET_ERROR		-5
62 #define	TSALARM_SET_ERROR		-6
63 
64 /*
65  * alarm set/get request message
66  */
67 typedef struct tsalarm_req {
68 	uint32_t	alarm_id;
69 	uint32_t	alarm_action;
70 } tsalarm_req_t;
71 
72 /*
73  * alarm set/get response message
74  */
75 typedef struct tsalarm_resp {
76 	uint32_t	status;
77 	uint32_t	alarm_id;
78 	uint32_t	alarm_state;
79 } tsalarm_resp_t;
80 
81 int tsalarm_get(uint32_t alarm_type, uint32_t *alarm_state);
82 int tsalarm_set(uint32_t alarm_type, uint32_t alarm_state);
83 
84 #ifdef	__cplusplus
85 }
86 #endif
87 
88 #endif /* _TSALARM_H */
89