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 #include <libnvpair.h> 31*70025d76Sjohnny #include <config_admin.h> 32*70025d76Sjohnny 33*70025d76Sjohnny #ifdef __cplusplus 34*70025d76Sjohnny extern "C" { 35*70025d76Sjohnny #endif 36*70025d76Sjohnny 37*70025d76Sjohnny #define PCIDR_MALLOC_CNT 5 38*70025d76Sjohnny #define PCIDR_MALLOC_TIME 1000000 39*70025d76Sjohnny 40*70025d76Sjohnny /* .._SYM and .._SYMSTR must match */ 41*70025d76Sjohnny #define PCIDR_PLUGIN_SYM pcidr_event_handler 42*70025d76Sjohnny #define PCIDR_PLUGIN_SYMSTR "pcidr_event_handler" 43*70025d76Sjohnny #define PCIDR_PLUGIN_NAME "pcidr_plugin.so" 44*70025d76Sjohnny 45*70025d76Sjohnny 46*70025d76Sjohnny /* 47*70025d76Sjohnny * these ATTRNM_* correspond to the built-in sysevent.conf macros 48*70025d76Sjohnny * Note that the "publisher" macro used by syseventd is only a subset (third 49*70025d76Sjohnny * colon-delimited field) of the full publisher-id string specified in an 50*70025d76Sjohnny * event buffer/message. 51*70025d76Sjohnny */ 52*70025d76Sjohnny #define ATTRNM_CLASS "class" 53*70025d76Sjohnny #define ATTRNM_SUBCLASS "subclass" 54*70025d76Sjohnny #define ATTRNM_PUB_NAME "publisher" 55*70025d76Sjohnny 56*70025d76Sjohnny /* be sure to match with dpritab! */ 57*70025d76Sjohnny typedef enum {DNONE = 0, DWARN, DINFO, DDEBUG} dlvl_t; 58*70025d76Sjohnny #define MIN_DLVL DNONE 59*70025d76Sjohnny #define MAX_DLVL DDEBUG 60*70025d76Sjohnny 61*70025d76Sjohnny /* default set of DR attributes */ 62*70025d76Sjohnny typedef struct { 63*70025d76Sjohnny char *class; 64*70025d76Sjohnny char *subclass; 65*70025d76Sjohnny char *pub_name; 66*70025d76Sjohnny char *dr_req_type; 67*70025d76Sjohnny char *dr_ap_id; 68*70025d76Sjohnny } pcidr_attrs_t; 69*70025d76Sjohnny 70*70025d76Sjohnny 71*70025d76Sjohnny typedef struct { 72*70025d76Sjohnny dlvl_t dlvl; 73*70025d76Sjohnny char *prg; 74*70025d76Sjohnny FILE *dfp; 75*70025d76Sjohnny int dsys; 76*70025d76Sjohnny } pcidr_logopt_t; 77*70025d76Sjohnny 78*70025d76Sjohnny typedef struct { 79*70025d76Sjohnny pcidr_logopt_t logopt; 80*70025d76Sjohnny } pcidr_opt_t; 81*70025d76Sjohnny 82*70025d76Sjohnny typedef int(*pcidr_plugin_t)(nvlist_t *, pcidr_opt_t *); 83*70025d76Sjohnny #define PCIDR_PLUGIN_PROTO(a, b) \ 84*70025d76Sjohnny int PCIDR_PLUGIN_SYM(nvlist_t *a, pcidr_opt_t *b) 85*70025d76Sjohnny 86*70025d76Sjohnny 87*70025d76Sjohnny void *pcidr_malloc(size_t); 88*70025d76Sjohnny void dprint(dlvl_t, char *, ...); 89*70025d76Sjohnny int pcidr_name2type(char *, data_type_t *); 90*70025d76Sjohnny void pcidr_print_attrlist(dlvl_t, nvlist_t *, char *); 91*70025d76Sjohnny int pcidr_check_string(char *, ...); 92*70025d76Sjohnny int pcidr_get_attrs(nvlist_t *, pcidr_attrs_t *); 93*70025d76Sjohnny int pcidr_check_attrs(pcidr_attrs_t *); 94*70025d76Sjohnny void pcidr_set_logopt(pcidr_logopt_t *); 95*70025d76Sjohnny 96*70025d76Sjohnny extern dlvl_t dlvl; 97*70025d76Sjohnny extern char *prg; 98*70025d76Sjohnny extern FILE *dfp; 99*70025d76Sjohnny extern int dsys; 100*70025d76Sjohnny extern char *prg; 101*70025d76Sjohnny extern int dpritab_len; 102*70025d76Sjohnny 103*70025d76Sjohnny #ifdef __cplusplus 104*70025d76Sjohnny } 105*70025d76Sjohnny #endif 106*70025d76Sjohnny 107*70025d76Sjohnny #endif /* _PCIDR_H */ 108