8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / fm / modules / common / ext-event-transport / fmevt.h
blobc8074002c676970f00e19f14061266862650b6f5
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
26 #ifndef _FMEVT_H
27 #define _FMEVT_H
30 * ext-event-transport module - implementation detail.
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 #include <libnvpair.h>
38 #include <fm/fmd_api.h>
39 #include <fm/libfmevent.h>
40 #include <sys/fm/protocol.h>
42 #include "../../../../../lib/fm/libfmevent/common/fmev_channels.h"
44 extern fmd_hdl_t *fmevt_hdl;
45 extern const fmd_prop_t fmevt_props[];
47 extern void fmevt_init_outbound(fmd_hdl_t *);
48 extern void fmevt_fini_outbound(fmd_hdl_t *);
50 extern void fmevt_init_inbound(fmd_hdl_t *);
51 extern void fmevt_fini_inbound(fmd_hdl_t *);
53 extern void fmevt_recv(fmd_hdl_t *, fmd_event_t *, nvlist_t *, const char *);
57 * Post-processing
61 * Structure passed to a post-processing functions with details of the
62 * raw event.
64 struct fmevt_ppargs {
65 const char *pp_rawclass; /* class from event publication */
66 const char *pp_rawsubclass; /* subclass from event publication */
67 hrtime_t pp_hrt; /* hrtime of event publication */
68 int pp_user; /* userland or kernel source? */
69 int pp_priv; /* privileged? */
70 fmev_pri_t pp_pri; /* published priority */
71 char pp_uuidstr[36 + 1]; /* uuid we'll use for first event */
75 * The maximum length that a protocol event class name generated
76 * in post-processing can be.
78 #define FMEVT_MAX_CLASS 64
81 * A post-processing function may derive up to this number of separate
82 * protocol events for each raw event.
84 #define FMEVT_FANOUT_MAX 5
87 * Post-processing function type. The function receives raw event
88 * details in the struct fmevt_ppargs. It must prepare up to
89 * FMEVT_FANOUT_MAX protocol events (usually just one event)
90 * based on the raw event, and return the number of events
91 * to be posted. The array of class pointers must have that
92 * number of non-NULL entries. You may return 0 to ditch an event;
93 * in this case the caller will not perform an frees so you must
94 * tidy up.
96 * The array of string pointers has the first member pointed to
97 * some storage of size FMEV_MAX_CLASS into which the post-processing
98 * function must render the protocol event classname. If fanning
99 * out into more than one event then the post-processing function
100 * must allocate additional buffers (using fmd_hdl_alloc) and return
101 * pointers to these in the array of string pointers (but do not change
102 * the first element); buffers allocated and returned in this way will
103 * be freed by the caller as it iterates over the protocol events to
104 * post them. Similarly the function must prepare an attributes
105 * nvlist for each event; it can return the raw attributes or it
106 * can fmd_nvl_alloc or fmd_nvl_dup and return those (to be freed
107 * by the caller).
109 * Events will be generated based on the results as follows:
111 * event[i] =
113 * timestamp = as supplied by incoming event and in pp_hrt
114 * class = class_array[i]; entry 0 is allocated, fmd_hdl_alloc others
115 * detector = generated detector as passed to function
116 * uuid = generated UUID, or that supplied by raw event
117 * attr = nvlist_array[i], can be absent; may return raw attributes
120 typedef uint_t fmevt_pp_func_t(
121 char *[FMEVT_FANOUT_MAX], /* event class(es) */
122 nvlist_t *[FMEVT_FANOUT_MAX], /* event attributes */
123 const char *, /* ruleset */
124 const nvlist_t *, /* detector */
125 nvlist_t *, /* raw attributes */
126 const struct fmevt_ppargs *); /* more raw event info */
128 extern fmevt_pp_func_t fmevt_pp_on_ereport;
129 extern fmevt_pp_func_t fmevt_pp_smf;
130 extern fmevt_pp_func_t fmevt_pp_on_sunos;
131 extern fmevt_pp_func_t fmevt_pp_on_private;
132 extern fmevt_pp_func_t fmevt_pp_unregistered;
134 #ifdef __cplusplus
136 #endif
138 #endif /* _FMEVT_H */