1*f6e214c7SGavin Maltby /*
2*f6e214c7SGavin Maltby  * CDDL HEADER START
3*f6e214c7SGavin Maltby  *
4*f6e214c7SGavin Maltby  * The contents of this file are subject to the terms of the
5*f6e214c7SGavin Maltby  * Common Development and Distribution License (the "License").
6*f6e214c7SGavin Maltby  * You may not use this file except in compliance with the License.
7*f6e214c7SGavin Maltby  *
8*f6e214c7SGavin Maltby  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*f6e214c7SGavin Maltby  * or http://www.opensolaris.org/os/licensing.
10*f6e214c7SGavin Maltby  * See the License for the specific language governing permissions
11*f6e214c7SGavin Maltby  * and limitations under the License.
12*f6e214c7SGavin Maltby  *
13*f6e214c7SGavin Maltby  * When distributing Covered Code, include this CDDL HEADER in each
14*f6e214c7SGavin Maltby  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*f6e214c7SGavin Maltby  * If applicable, add the following below this CDDL HEADER, with the
16*f6e214c7SGavin Maltby  * fields enclosed by brackets "[]" replaced with your own identifying
17*f6e214c7SGavin Maltby  * information: Portions Copyright [yyyy] [name of copyright owner]
18*f6e214c7SGavin Maltby  *
19*f6e214c7SGavin Maltby  * CDDL HEADER END
20*f6e214c7SGavin Maltby  */
21*f6e214c7SGavin Maltby 
22*f6e214c7SGavin Maltby /*
23*f6e214c7SGavin Maltby  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24*f6e214c7SGavin Maltby  */
25*f6e214c7SGavin Maltby 
26*f6e214c7SGavin Maltby #include "fmevt.h"
27*f6e214c7SGavin Maltby 
28*f6e214c7SGavin Maltby /*
29*f6e214c7SGavin Maltby  * Post-processing according to the FMEV_RULESET_UNREGISTERED ruleset.
30*f6e214c7SGavin Maltby  *
31*f6e214c7SGavin Maltby  * Generate a class of ireport.unregistered.<raw-class>.<raw-subclass>
32*f6e214c7SGavin Maltby  * with attributes just those of the raw event.  If either the raw
33*f6e214c7SGavin Maltby  * class or subclass is NULL or empty then drop the event.
34*f6e214c7SGavin Maltby  */
35*f6e214c7SGavin Maltby /*ARGSUSED*/
36*f6e214c7SGavin Maltby uint_t
fmevt_pp_unregistered(char * classes[FMEVT_FANOUT_MAX],nvlist_t * attr[FMEVT_FANOUT_MAX],const char * ruleset,const nvlist_t * detector,nvlist_t * rawattr,const struct fmevt_ppargs * eap)37*f6e214c7SGavin Maltby fmevt_pp_unregistered(char *classes[FMEVT_FANOUT_MAX],
38*f6e214c7SGavin Maltby     nvlist_t *attr[FMEVT_FANOUT_MAX], const char *ruleset,
39*f6e214c7SGavin Maltby     const nvlist_t *detector, nvlist_t *rawattr,
40*f6e214c7SGavin Maltby     const struct fmevt_ppargs *eap)
41*f6e214c7SGavin Maltby {
42*f6e214c7SGavin Maltby 	if (eap->pp_rawclass == NULL || eap->pp_rawsubclass == NULL)
43*f6e214c7SGavin Maltby 		return (0);
44*f6e214c7SGavin Maltby 
45*f6e214c7SGavin Maltby 	if (snprintf(classes[0], FMEVT_MAX_CLASS, "%s.%s.%s.%s",
46*f6e214c7SGavin Maltby 	    FM_IREPORT_CLASS, "unregistered",
47*f6e214c7SGavin Maltby 	    eap->pp_rawclass, eap->pp_rawsubclass) >= FMEVT_MAX_CLASS - 1)
48*f6e214c7SGavin Maltby 		return (0);
49*f6e214c7SGavin Maltby 
50*f6e214c7SGavin Maltby 	attr[0] = rawattr;
51*f6e214c7SGavin Maltby 	return (1);
52*f6e214c7SGavin Maltby }
53