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