1/*
2 * CDDL HEADER START
3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26#include <sys/types.h>
27
28#include "fmevt.h"
29
30const fmd_prop_t fmevt_props[] = {
31	{ "protocol_forward_disable", FMD_TYPE_BOOL, "false" },
32	{ "outbound_channel", FMD_TYPE_STRING, FMD_SNOOP_CHANNEL },
33	{ "outbound_channel_depth", FMD_TYPE_INT32, "256" },
34	{ "user_priv_highval_channel", FMD_TYPE_STRING,
35	    FMEV_CHAN_USER_PRIV_HV },
36	{ "user_priv_lowval_channel", FMD_TYPE_STRING,
37	    FMEV_CHAN_USER_PRIV_LV },
38	{ "sidprefix", FMD_TYPE_STRING, "fmd" },
39	{ "inbound_postprocess_smf", FMD_TYPE_BOOL, "true" },
40	{ NULL, 0, NULL },
41};
42
43static const fmd_hdl_ops_t fmd_ops = {
44	fmevt_recv,	/* fmdo_recv */
45	NULL,		/* fmdo_timeout */
46	NULL,		/* fmdo_close */
47	NULL,		/* fmdo_stats */
48	NULL,		/* fmdo_gc */
49	NULL,		/* fmdo_send */
50	NULL		/* fmdo_topo */
51};
52
53static const fmd_hdl_info_t fmd_info = {
54	"External FM event transport", "0.2", &fmd_ops, fmevt_props
55};
56
57fmd_hdl_t *fmevt_hdl;
58
59void
60_fmd_init(fmd_hdl_t *hdl)
61{
62	/*
63	 * Register the handle, pulling in configuration from our
64	 * conf file.  This includes our event class subscriptions
65	 * for those events that we will forward out of fmd.
66	 */
67	if (fmd_hdl_register(hdl, FMD_API_VERSION, &fmd_info) != 0)
68		return;
69
70	fmevt_hdl = hdl;
71
72	fmevt_init_outbound(hdl);
73	fmevt_init_inbound(hdl);
74}
75
76void
77_fmd_fini(fmd_hdl_t *hdl)
78{
79	fmevt_fini_outbound(hdl);
80	fmevt_fini_inbound(hdl);
81}
82