xref: /onnv-gate/usr/src/lib/fm/libfmd_snmp/common/sunFM_impl.h (revision 1303:6e5751a0b831)
1*1303Swesolows /*
2*1303Swesolows  * CDDL HEADER START
3*1303Swesolows  *
4*1303Swesolows  * The contents of this file are subject to the terms of the
5*1303Swesolows  * Common Development and Distribution License (the "License").
6*1303Swesolows  * You may not use this file except in compliance with the License.
7*1303Swesolows  *
8*1303Swesolows  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*1303Swesolows  * or http://www.opensolaris.org/os/licensing.
10*1303Swesolows  * See the License for the specific language governing permissions
11*1303Swesolows  * and limitations under the License.
12*1303Swesolows  *
13*1303Swesolows  * When distributing Covered Code, include this CDDL HEADER in each
14*1303Swesolows  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*1303Swesolows  * If applicable, add the following below this CDDL HEADER, with the
16*1303Swesolows  * fields enclosed by brackets "[]" replaced with your own identifying
17*1303Swesolows  * information: Portions Copyright [yyyy] [name of copyright owner]
18*1303Swesolows  *
19*1303Swesolows  * CDDL HEADER END
20*1303Swesolows  */
21*1303Swesolows 
22*1303Swesolows /*
23*1303Swesolows  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*1303Swesolows  * Use is subject to license terms.
25*1303Swesolows  */
26*1303Swesolows 
27*1303Swesolows #ifndef	_SUNFM_IMPL_H
28*1303Swesolows #define	_SUNFM_IMPL_H
29*1303Swesolows 
30*1303Swesolows #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*1303Swesolows 
32*1303Swesolows #ifdef	__cplusplus
33*1303Swesolows extern "C" {
34*1303Swesolows #endif
35*1303Swesolows 
36*1303Swesolows #include <net-snmp/net-snmp-config.h>
37*1303Swesolows #include <net-snmp/net-snmp-includes.h>
38*1303Swesolows #include <net-snmp/agent/net-snmp-agent-includes.h>
39*1303Swesolows #include <libnvpair.h>
40*1303Swesolows #include <stdarg.h>
41*1303Swesolows 
42*1303Swesolows #ifdef DEBUG
43*1303Swesolows extern void sunFm_panic(const char *format, ...) __NORETURN;
44*1303Swesolows extern void sunFm_vpanic(const char *format, va_list ap) __NORETURN;
45*1303Swesolows extern int sunFm_assert(const char *, const char *, int);
46*1303Swesolows #define	ASSERT(x)	((void)((x) || sunFm_assert(#x, __FILE__, __LINE__)))
47*1303Swesolows #else
48*1303Swesolows extern void sunFm_panic(const char *format, ...);
49*1303Swesolows extern void sunFm_vpanic(const char *format, va_list ap);
50*1303Swesolows #define	ASSERT(x)
51*1303Swesolows #endif
52*1303Swesolows 
53*1303Swesolows typedef int (*sunFm_table_init_func_t)(void);
54*1303Swesolows 
55*1303Swesolows typedef struct sunFm_table {
56*1303Swesolows 	const char		*t_name;
57*1303Swesolows 	sunFm_table_init_func_t	t_init;
58*1303Swesolows } sunFm_table_t;
59*1303Swesolows 
60*1303Swesolows #define	TABLE_INIT(__t)	__t##_init
61*1303Swesolows #define	TABLE_NAME(__t)	#__t
62*1303Swesolows #define	TABLE_REG(__t)	{ TABLE_NAME(__t), TABLE_INIT(__t) }
63*1303Swesolows #define	TABLE_NULL	{ NULL, NULL }
64*1303Swesolows 
65*1303Swesolows /*
66*1303Swesolows  * The definition of netsnmp_table_helper_add_index in <net-snmp/agent/table.h>
67*1303Swesolows  * is defective; it includes a ; at the end.  We have to use our own.
68*1303Swesolows  */
69*1303Swesolows #ifdef	netsnmp_table_helper_add_index
70*1303Swesolows #undef	netsnmp_table_helper_add_index
71*1303Swesolows #define	netsnmp_table_helper_add_index(tinfo, type) \
72*1303Swesolows 	snmp_varlist_add_variable(&tinfo->indexes, NULL, 0, (uchar_t)type, \
73*1303Swesolows 	NULL, 0)
74*1303Swesolows #endif	/* netsnmp_table_helper_add_index */
75*1303Swesolows 
76*1303Swesolows extern char *sunFm_nvl2str(nvlist_t *);
77*1303Swesolows 
78*1303Swesolows #ifdef	__cplusplus
79*1303Swesolows }
80*1303Swesolows #endif
81*1303Swesolows 
82*1303Swesolows #endif	/* _SUNFM_IMPL_H */
83