70025d765b044c6d8594bb965a2247a61e991a99johnny/*
70025d765b044c6d8594bb965a2247a61e991a99johnny * CDDL HEADER START
70025d765b044c6d8594bb965a2247a61e991a99johnny *
70025d765b044c6d8594bb965a2247a61e991a99johnny * The contents of this file are subject to the terms of the
70025d765b044c6d8594bb965a2247a61e991a99johnny * Common Development and Distribution License, Version 1.0 only
70025d765b044c6d8594bb965a2247a61e991a99johnny * (the "License"). You may not use this file except in compliance
70025d765b044c6d8594bb965a2247a61e991a99johnny * with the License.
70025d765b044c6d8594bb965a2247a61e991a99johnny *
70025d765b044c6d8594bb965a2247a61e991a99johnny * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
70025d765b044c6d8594bb965a2247a61e991a99johnny * or http://www.opensolaris.org/os/licensing.
70025d765b044c6d8594bb965a2247a61e991a99johnny * See the License for the specific language governing permissions
70025d765b044c6d8594bb965a2247a61e991a99johnny * and limitations under the License.
70025d765b044c6d8594bb965a2247a61e991a99johnny *
70025d765b044c6d8594bb965a2247a61e991a99johnny * When distributing Covered Code, include this CDDL HEADER in each
70025d765b044c6d8594bb965a2247a61e991a99johnny * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
70025d765b044c6d8594bb965a2247a61e991a99johnny * If applicable, add the following below this CDDL HEADER, with the
70025d765b044c6d8594bb965a2247a61e991a99johnny * fields enclosed by brackets "[]" replaced with your own identifying
70025d765b044c6d8594bb965a2247a61e991a99johnny * information: Portions Copyright [yyyy] [name of copyright owner]
70025d765b044c6d8594bb965a2247a61e991a99johnny *
70025d765b044c6d8594bb965a2247a61e991a99johnny * CDDL HEADER END
70025d765b044c6d8594bb965a2247a61e991a99johnny */
70025d765b044c6d8594bb965a2247a61e991a99johnny/*
70025d765b044c6d8594bb965a2247a61e991a99johnny * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
70025d765b044c6d8594bb965a2247a61e991a99johnny * Use is subject to license terms.
70025d765b044c6d8594bb965a2247a61e991a99johnny */
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny#ifndef _PCIDR_H
70025d765b044c6d8594bb965a2247a61e991a99johnny#define _PCIDR_H
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny#pragma ident "%Z%%M% %I% %E% SMI"
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny#include <libnvpair.h>
70025d765b044c6d8594bb965a2247a61e991a99johnny#include <config_admin.h>
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny#ifdef __cplusplus
70025d765b044c6d8594bb965a2247a61e991a99johnnyextern "C" {
70025d765b044c6d8594bb965a2247a61e991a99johnny#endif
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny#define PCIDR_MALLOC_CNT 5
70025d765b044c6d8594bb965a2247a61e991a99johnny#define PCIDR_MALLOC_TIME 1000000
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny/* .._SYM and .._SYMSTR must match */
70025d765b044c6d8594bb965a2247a61e991a99johnny#define PCIDR_PLUGIN_SYM pcidr_event_handler
70025d765b044c6d8594bb965a2247a61e991a99johnny#define PCIDR_PLUGIN_SYMSTR "pcidr_event_handler"
70025d765b044c6d8594bb965a2247a61e991a99johnny#define PCIDR_PLUGIN_NAME "pcidr_plugin.so"
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny/*
70025d765b044c6d8594bb965a2247a61e991a99johnny * these ATTRNM_* correspond to the built-in sysevent.conf macros
70025d765b044c6d8594bb965a2247a61e991a99johnny * Note that the "publisher" macro used by syseventd is only a subset (third
70025d765b044c6d8594bb965a2247a61e991a99johnny * colon-delimited field) of the full publisher-id string specified in an
70025d765b044c6d8594bb965a2247a61e991a99johnny * event buffer/message.
70025d765b044c6d8594bb965a2247a61e991a99johnny */
70025d765b044c6d8594bb965a2247a61e991a99johnny#define ATTRNM_CLASS "class"
70025d765b044c6d8594bb965a2247a61e991a99johnny#define ATTRNM_SUBCLASS "subclass"
70025d765b044c6d8594bb965a2247a61e991a99johnny#define ATTRNM_PUB_NAME "publisher"
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny/* be sure to match with dpritab! */
70025d765b044c6d8594bb965a2247a61e991a99johnnytypedef enum {DNONE = 0, DWARN, DINFO, DDEBUG} dlvl_t;
70025d765b044c6d8594bb965a2247a61e991a99johnny#define MIN_DLVL DNONE
70025d765b044c6d8594bb965a2247a61e991a99johnny#define MAX_DLVL DDEBUG
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny/* default set of DR attributes */
70025d765b044c6d8594bb965a2247a61e991a99johnnytypedef struct {
70025d765b044c6d8594bb965a2247a61e991a99johnny char *class;
70025d765b044c6d8594bb965a2247a61e991a99johnny char *subclass;
70025d765b044c6d8594bb965a2247a61e991a99johnny char *pub_name;
70025d765b044c6d8594bb965a2247a61e991a99johnny char *dr_req_type;
70025d765b044c6d8594bb965a2247a61e991a99johnny char *dr_ap_id;
70025d765b044c6d8594bb965a2247a61e991a99johnny} pcidr_attrs_t;
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnnytypedef struct {
70025d765b044c6d8594bb965a2247a61e991a99johnny dlvl_t dlvl;
70025d765b044c6d8594bb965a2247a61e991a99johnny char *prg;
70025d765b044c6d8594bb965a2247a61e991a99johnny FILE *dfp;
70025d765b044c6d8594bb965a2247a61e991a99johnny int dsys;
70025d765b044c6d8594bb965a2247a61e991a99johnny} pcidr_logopt_t;
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnnytypedef struct {
70025d765b044c6d8594bb965a2247a61e991a99johnny pcidr_logopt_t logopt;
70025d765b044c6d8594bb965a2247a61e991a99johnny} pcidr_opt_t;
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnnytypedef int(*pcidr_plugin_t)(nvlist_t *, pcidr_opt_t *);
70025d765b044c6d8594bb965a2247a61e991a99johnny#define PCIDR_PLUGIN_PROTO(a, b) \
70025d765b044c6d8594bb965a2247a61e991a99johnny int PCIDR_PLUGIN_SYM(nvlist_t *a, pcidr_opt_t *b)
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnnyvoid *pcidr_malloc(size_t);
70025d765b044c6d8594bb965a2247a61e991a99johnnyvoid dprint(dlvl_t, char *, ...);
70025d765b044c6d8594bb965a2247a61e991a99johnnyint pcidr_name2type(char *, data_type_t *);
70025d765b044c6d8594bb965a2247a61e991a99johnnyvoid pcidr_print_attrlist(dlvl_t, nvlist_t *, char *);
70025d765b044c6d8594bb965a2247a61e991a99johnnyint pcidr_check_string(char *, ...);
70025d765b044c6d8594bb965a2247a61e991a99johnnyint pcidr_get_attrs(nvlist_t *, pcidr_attrs_t *);
70025d765b044c6d8594bb965a2247a61e991a99johnnyint pcidr_check_attrs(pcidr_attrs_t *);
70025d765b044c6d8594bb965a2247a61e991a99johnnyvoid pcidr_set_logopt(pcidr_logopt_t *);
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnnyextern dlvl_t dlvl;
70025d765b044c6d8594bb965a2247a61e991a99johnnyextern char *prg;
70025d765b044c6d8594bb965a2247a61e991a99johnnyextern FILE *dfp;
70025d765b044c6d8594bb965a2247a61e991a99johnnyextern int dsys;
70025d765b044c6d8594bb965a2247a61e991a99johnnyextern char *prg;
70025d765b044c6d8594bb965a2247a61e991a99johnnyextern int dpritab_len;
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny#ifdef __cplusplus
70025d765b044c6d8594bb965a2247a61e991a99johnny}
70025d765b044c6d8594bb965a2247a61e991a99johnny#endif
70025d765b044c6d8594bb965a2247a61e991a99johnny
70025d765b044c6d8594bb965a2247a61e991a99johnny#endif /* _PCIDR_H */