1*70025d76Sjohnny /* 2*70025d76Sjohnny * CDDL HEADER START 3*70025d76Sjohnny * 4*70025d76Sjohnny * The contents of this file are subject to the terms of the 5*70025d76Sjohnny * Common Development and Distribution License, Version 1.0 only 6*70025d76Sjohnny * (the "License"). You may not use this file except in compliance 7*70025d76Sjohnny * with the License. 8*70025d76Sjohnny * 9*70025d76Sjohnny * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*70025d76Sjohnny * or http://www.opensolaris.org/os/licensing. 11*70025d76Sjohnny * See the License for the specific language governing permissions 12*70025d76Sjohnny * and limitations under the License. 13*70025d76Sjohnny * 14*70025d76Sjohnny * When distributing Covered Code, include this CDDL HEADER in each 15*70025d76Sjohnny * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*70025d76Sjohnny * If applicable, add the following below this CDDL HEADER, with the 17*70025d76Sjohnny * fields enclosed by brackets "[]" replaced with your own identifying 18*70025d76Sjohnny * information: Portions Copyright [yyyy] [name of copyright owner] 19*70025d76Sjohnny * 20*70025d76Sjohnny * CDDL HEADER END 21*70025d76Sjohnny */ 22*70025d76Sjohnny /* 23*70025d76Sjohnny * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*70025d76Sjohnny * Use is subject to license terms. 25*70025d76Sjohnny */ 26*70025d76Sjohnny 27*70025d76Sjohnny #ifndef _PCIDR_H 28*70025d76Sjohnny #define _PCIDR_H 29*70025d76Sjohnny 30*70025d76Sjohnny #pragma ident "%Z%%M% %I% %E% SMI" 31*70025d76Sjohnny 32*70025d76Sjohnny #include <libnvpair.h> 33*70025d76Sjohnny #include <config_admin.h> 34*70025d76Sjohnny 35*70025d76Sjohnny #ifdef __cplusplus 36*70025d76Sjohnny extern "C" { 37*70025d76Sjohnny #endif 38*70025d76Sjohnny 39*70025d76Sjohnny #define PCIDR_MALLOC_CNT 5 40*70025d76Sjohnny #define PCIDR_MALLOC_TIME 1000000 41*70025d76Sjohnny 42*70025d76Sjohnny /* .._SYM and .._SYMSTR must match */ 43*70025d76Sjohnny #define PCIDR_PLUGIN_SYM pcidr_event_handler 44*70025d76Sjohnny #define PCIDR_PLUGIN_SYMSTR "pcidr_event_handler" 45*70025d76Sjohnny #define PCIDR_PLUGIN_NAME "pcidr_plugin.so" 46*70025d76Sjohnny 47*70025d76Sjohnny 48*70025d76Sjohnny /* 49*70025d76Sjohnny * these ATTRNM_* correspond to the built-in sysevent.conf macros 50*70025d76Sjohnny * Note that the "publisher" macro used by syseventd is only a subset (third 51*70025d76Sjohnny * colon-delimited field) of the full publisher-id string specified in an 52*70025d76Sjohnny * event buffer/message. 53*70025d76Sjohnny */ 54*70025d76Sjohnny #define ATTRNM_CLASS "class" 55*70025d76Sjohnny #define ATTRNM_SUBCLASS "subclass" 56*70025d76Sjohnny #define ATTRNM_PUB_NAME "publisher" 57*70025d76Sjohnny 58*70025d76Sjohnny /* be sure to match with dpritab! */ 59*70025d76Sjohnny typedef enum {DNONE = 0, DWARN, DINFO, DDEBUG} dlvl_t; 60*70025d76Sjohnny #define MIN_DLVL DNONE 61*70025d76Sjohnny #define MAX_DLVL DDEBUG 62*70025d76Sjohnny 63*70025d76Sjohnny /* default set of DR attributes */ 64*70025d76Sjohnny typedef struct { 65*70025d76Sjohnny char *class; 66*70025d76Sjohnny char *subclass; 67*70025d76Sjohnny char *pub_name; 68*70025d76Sjohnny char *dr_req_type; 69*70025d76Sjohnny char *dr_ap_id; 70*70025d76Sjohnny } pcidr_attrs_t; 71*70025d76Sjohnny 72*70025d76Sjohnny 73*70025d76Sjohnny typedef struct { 74*70025d76Sjohnny dlvl_t dlvl; 75*70025d76Sjohnny char *prg; 76*70025d76Sjohnny FILE *dfp; 77*70025d76Sjohnny int dsys; 78*70025d76Sjohnny } pcidr_logopt_t; 79*70025d76Sjohnny 80*70025d76Sjohnny typedef struct { 81*70025d76Sjohnny pcidr_logopt_t logopt; 82*70025d76Sjohnny } pcidr_opt_t; 83*70025d76Sjohnny 84*70025d76Sjohnny typedef int(*pcidr_plugin_t)(nvlist_t *, pcidr_opt_t *); 85*70025d76Sjohnny #define PCIDR_PLUGIN_PROTO(a, b) \ 86*70025d76Sjohnny int PCIDR_PLUGIN_SYM(nvlist_t *a, pcidr_opt_t *b) 87*70025d76Sjohnny 88*70025d76Sjohnny 89*70025d76Sjohnny void *pcidr_malloc(size_t); 90*70025d76Sjohnny void dprint(dlvl_t, char *, ...); 91*70025d76Sjohnny int pcidr_name2type(char *, data_type_t *); 92*70025d76Sjohnny void pcidr_print_attrlist(dlvl_t, nvlist_t *, char *); 93*70025d76Sjohnny int pcidr_check_string(char *, ...); 94*70025d76Sjohnny int pcidr_get_attrs(nvlist_t *, pcidr_attrs_t *); 95*70025d76Sjohnny int pcidr_check_attrs(pcidr_attrs_t *); 96*70025d76Sjohnny void pcidr_set_logopt(pcidr_logopt_t *); 97*70025d76Sjohnny 98*70025d76Sjohnny extern dlvl_t dlvl; 99*70025d76Sjohnny extern char *prg; 100*70025d76Sjohnny extern FILE *dfp; 101*70025d76Sjohnny extern int dsys; 102*70025d76Sjohnny extern char *prg; 103*70025d76Sjohnny extern int dpritab_len; 104*70025d76Sjohnny 105*70025d76Sjohnny #ifdef __cplusplus 106*70025d76Sjohnny } 107*70025d76Sjohnny #endif 108*70025d76Sjohnny 109*70025d76Sjohnny #endif /* _PCIDR_H */ 110