70025d765b044c6d8594bb965a2247a61e991a99johnny * CDDL HEADER START
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 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
70025d765b044c6d8594bb965a2247a61e991a99johnny * See the License for the specific language governing permissions
70025d765b044c6d8594bb965a2247a61e991a99johnny * and limitations under the License.
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 * CDDL HEADER END
70025d765b044c6d8594bb965a2247a61e991a99johnny * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
70025d765b044c6d8594bb965a2247a61e991a99johnny * Use is subject to license terms.
70025d765b044c6d8594bb965a2247a61e991a99johnny#pragma ident "%Z%%M% %I% %E% SMI"
70025d765b044c6d8594bb965a2247a61e991a99johnny * How dpritab is used:
70025d765b044c6d8594bb965a2247a61e991a99johnny * dpritab[dlvl_t value] = corresponding syslog priority
70025d765b044c6d8594bb965a2247a61e991a99johnny * Be careful of some priorities (facility + severity) that get "lost" by
70025d765b044c6d8594bb965a2247a61e991a99johnny * default since they have no syslog.conf entries such as daemon.info and
70025d765b044c6d8594bb965a2247a61e991a99johnny * daemon.debug; see syslog(3C) and syslog.conf(4) for more info
70025d765b044c6d8594bb965a2247a61e991a99johnnyint dpritab[] = {LOG_INFO, LOG_WARNING, LOG_NOTICE, LOG_NOTICE};
70025d765b044c6d8594bb965a2247a61e991a99johnnyint dpritab_len = sizeof (dpritab) / sizeof (dpritab[0]);
70025d765b044c6d8594bb965a2247a61e991a99johnny * the following affects pcidr_set_logopt() which plugins should use to set
70025d765b044c6d8594bb965a2247a61e991a99johnny * these logging options received from the handler
70025d765b044c6d8594bb965a2247a61e991a99johnny for (i = 0; i < PCIDR_MALLOC_CNT; i++) {
70025d765b044c6d8594bb965a2247a61e991a99johnny /* exit() in case assertions are disabled (NDEBUG defined) */
70025d765b044c6d8594bb965a2247a61e991a99johnny if (rv <= 0) {
70025d765b044c6d8594bb965a2247a61e991a99johnny * if <name> is recognized, function will return its type through <typep> and
70025d765b044c6d8594bb965a2247a61e991a99johnny * return 0; else function will return non-zero
70025d765b044c6d8594bb965a2247a61e991a99johnny /* string type */
70025d765b044c6d8594bb965a2247a61e991a99johnny return (0);
70025d765b044c6d8594bb965a2247a61e991a99johnny return (1);
70025d765b044c6d8594bb965a2247a61e991a99johnnypcidr_print_attrlist(dlvl_t lvl, nvlist_t *attrlistp, char *prestr)
70025d765b044c6d8594bb965a2247a61e991a99johnny while ((nvpairp = nvlist_next_nvpair(attrlistp, nvpairp)) != NULL) {
70025d765b044c6d8594bb965a2247a61e991a99johnny if (rv != 0) {
70025d765b044c6d8594bb965a2247a61e991a99johnny "failed: name = %s, rv = %d\n",
70025d765b044c6d8594bb965a2247a61e991a99johnny * if one of the args matches <valstr>, return 0; else return non-zero
70025d765b044c6d8594bb965a2247a61e991a99johnny * args list must be NULL terminated;
70025d765b044c6d8594bb965a2247a61e991a99johnny * if args list is empty, this will return 0 if <valstr> is NOT empty
70025d765b044c6d8594bb965a2247a61e991a99johnny * dr attribute values that the default plugin checks for;
70025d765b044c6d8594bb965a2247a61e991a99johnny * other plugins may also use this if they support a superset of these
70025d765b044c6d8594bb965a2247a61e991a99johnny * returns 0 if valid, else non-zero
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(DDEBUG, "%s: attribute \"%s\" has invalid value = %s\n",
70025d765b044c6d8594bb965a2247a61e991a99johnny if (pcidr_check_string(val, ESC_DR_REQ, NULL) != 0) {
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(DDEBUG, "%s: attribute \"%s\" has invalid value = %s\n",
70025d765b044c6d8594bb965a2247a61e991a99johnny if (pcidr_check_string(val, DR_REQ_INCOMING_RES, DR_REQ_OUTGOING_RES,
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(DDEBUG, "%s: attribute \"%s\" has invalid value = %s\n",
70025d765b044c6d8594bb965a2247a61e991a99johnny * get dr attributes from <listp> for the default plugin and returns
70025d765b044c6d8594bb965a2247a61e991a99johnny * them through <drp>;
70025d765b044c6d8594bb965a2247a61e991a99johnny * returns 0 on success
70025d765b044c6d8594bb965a2247a61e991a99johnnypcidr_get_attrs(nvlist_t *attrlistp, pcidr_attrs_t *drp)
70025d765b044c6d8594bb965a2247a61e991a99johnny r = nvlist_lookup_string(attrlistp, name, &drp->class);
70025d765b044c6d8594bb965a2247a61e991a99johnny if (r != 0) {
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(DDEBUG, "%s: nvlist_lookup_string() failed for "
70025d765b044c6d8594bb965a2247a61e991a99johnny r = nvlist_lookup_string(attrlistp, name, &drp->subclass);
70025d765b044c6d8594bb965a2247a61e991a99johnny if (r != 0) {
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(DDEBUG, "%s: nvlist_lookup_string() failed for "
70025d765b044c6d8594bb965a2247a61e991a99johnny r = nvlist_lookup_string(attrlistp, name, &drp->pub_name);
70025d765b044c6d8594bb965a2247a61e991a99johnny if (r != 0) {
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(DDEBUG, "%s: nvlist_lookup_string() failed for "
70025d765b044c6d8594bb965a2247a61e991a99johnny r = nvlist_lookup_string(attrlistp, name, &drp->dr_req_type);
70025d765b044c6d8594bb965a2247a61e991a99johnny if (r != 0) {
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(DDEBUG, "%s: nvlist_lookup_string() failed for "
70025d765b044c6d8594bb965a2247a61e991a99johnny r = nvlist_lookup_string(attrlistp, name, &drp->dr_ap_id);
70025d765b044c6d8594bb965a2247a61e991a99johnny if (r != 0) {
70025d765b044c6d8594bb965a2247a61e991a99johnny dprint(DDEBUG, "%s: nvlist_lookup_string() failed for "