749f21d359d8fbd020c974a1a5227316221bfc9cwesolows/*
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * CDDL HEADER START
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows *
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * The contents of this file are subject to the terms of the
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * Common Development and Distribution License (the "License").
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * You may not use this file except in compliance with the License.
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows *
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * or http://www.opensolaris.org/os/licensing.
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * See the License for the specific language governing permissions
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * and limitations under the License.
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows *
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * When distributing Covered Code, include this CDDL HEADER in each
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * If applicable, add the following below this CDDL HEADER, with the
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * fields enclosed by brackets "[]" replaced with your own identifying
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * information: Portions Copyright [yyyy] [name of copyright owner]
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows *
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * CDDL HEADER END
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows */
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows/*
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * Use is subject to license terms.
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows */
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#ifndef _SUNFM_IMPL_H
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#define _SUNFM_IMPL_H
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#pragma ident "%Z%%M% %I% %E% SMI"
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#ifdef __cplusplus
749f21d359d8fbd020c974a1a5227316221bfc9cwesolowsextern "C" {
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#endif
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#include <net-snmp/net-snmp-config.h>
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#include <net-snmp/net-snmp-includes.h>
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#include <net-snmp/agent/net-snmp-agent-includes.h>
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#include <libnvpair.h>
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#include <stdarg.h>
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#ifdef DEBUG
749f21d359d8fbd020c974a1a5227316221bfc9cwesolowsextern void sunFm_panic(const char *format, ...) __NORETURN;
749f21d359d8fbd020c974a1a5227316221bfc9cwesolowsextern void sunFm_vpanic(const char *format, va_list ap) __NORETURN;
749f21d359d8fbd020c974a1a5227316221bfc9cwesolowsextern int sunFm_assert(const char *, const char *, int);
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#define ASSERT(x) ((void)((x) || sunFm_assert(#x, __FILE__, __LINE__)))
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#else
749f21d359d8fbd020c974a1a5227316221bfc9cwesolowsextern void sunFm_panic(const char *format, ...);
749f21d359d8fbd020c974a1a5227316221bfc9cwesolowsextern void sunFm_vpanic(const char *format, va_list ap);
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#define ASSERT(x)
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#endif
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolowstypedef int (*sunFm_table_init_func_t)(void);
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolowstypedef struct sunFm_table {
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows const char *t_name;
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows sunFm_table_init_func_t t_init;
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows} sunFm_table_t;
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#define TABLE_INIT(__t) __t##_init
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#define TABLE_NAME(__t) #__t
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#define TABLE_REG(__t) { TABLE_NAME(__t), TABLE_INIT(__t) }
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#define TABLE_NULL { NULL, NULL }
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows/*
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * The definition of netsnmp_table_helper_add_index in <net-snmp/agent/table.h>
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows * is defective; it includes a ; at the end. We have to use our own.
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows */
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#ifdef netsnmp_table_helper_add_index
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#undef netsnmp_table_helper_add_index
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#define netsnmp_table_helper_add_index(tinfo, type) \
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows snmp_varlist_add_variable(&tinfo->indexes, NULL, 0, (uchar_t)type, \
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows NULL, 0)
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#endif /* netsnmp_table_helper_add_index */
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolowsextern char *sunFm_nvl2str(nvlist_t *);
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#ifdef __cplusplus
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows}
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#endif
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows
749f21d359d8fbd020c974a1a5227316221bfc9cwesolows#endif /* _SUNFM_IMPL_H */