49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby/*
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * CDDL HEADER START
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby *
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * The contents of this file are subject to the terms of the
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * Common Development and Distribution License (the "License").
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * You may not use this file except in compliance with the License.
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby *
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * or http://www.opensolaris.org/os/licensing.
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * See the License for the specific language governing permissions
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * and limitations under the License.
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby *
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * When distributing Covered Code, include this CDDL HEADER in each
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * If applicable, add the following below this CDDL HEADER, with the
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * fields enclosed by brackets "[]" replaced with your own identifying
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * information: Portions Copyright [yyyy] [name of copyright owner]
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby *
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * CDDL HEADER END
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby */
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby/*
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby */
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby#include <sys/types.h>
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby#include "fmevt.h"
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltbyconst fmd_prop_t fmevt_props[] = {
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby { "protocol_forward_disable", FMD_TYPE_BOOL, "false" },
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby { "outbound_channel", FMD_TYPE_STRING, FMD_SNOOP_CHANNEL },
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby { "outbound_channel_depth", FMD_TYPE_INT32, "256" },
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby { "user_priv_highval_channel", FMD_TYPE_STRING,
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby FMEV_CHAN_USER_PRIV_HV },
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby { "user_priv_lowval_channel", FMD_TYPE_STRING,
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby FMEV_CHAN_USER_PRIV_LV },
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby { "sidprefix", FMD_TYPE_STRING, "fmd" },
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby { "inbound_postprocess_smf", FMD_TYPE_BOOL, "true" },
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby { NULL, 0, NULL },
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby};
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltbystatic const fmd_hdl_ops_t fmd_ops = {
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby fmevt_recv, /* fmdo_recv */
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby NULL, /* fmdo_timeout */
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby NULL, /* fmdo_close */
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby NULL, /* fmdo_stats */
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby NULL, /* fmdo_gc */
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby NULL, /* fmdo_send */
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby NULL /* fmdo_topo */
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby};
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltbystatic const fmd_hdl_info_t fmd_info = {
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby "External FM event transport", "0.2", &fmd_ops, fmevt_props
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby};
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltbyfmd_hdl_t *fmevt_hdl;
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltbyvoid
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby_fmd_init(fmd_hdl_t *hdl)
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby{
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby /*
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * Register the handle, pulling in configuration from our
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * conf file. This includes our event class subscriptions
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby * for those events that we will forward out of fmd.
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby */
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby if (fmd_hdl_register(hdl, FMD_API_VERSION, &fmd_info) != 0)
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby return;
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby fmevt_hdl = hdl;
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby fmevt_init_outbound(hdl);
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby fmevt_init_inbound(hdl);
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby}
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltbyvoid
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby_fmd_fini(fmd_hdl_t *hdl)
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby{
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby fmevt_fini_outbound(hdl);
f6e214c7418f43af38bd8c3a557e3d0a1d311cfaGavin Maltby fmevt_fini_inbound(hdl);
49b225e1cfa7bbf7738d4df0a03f18e3283426ebGavin Maltby}