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