2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A#ifndef _LIBFMNOTIFY_H
2N/A#define _LIBFMNOTIFY_H
2N/A
2N/A#include <stdio.h>
2N/A#include <stdlib.h>
2N/A#include <string.h>
2N/A#include <alloca.h>
2N/A#include <errno.h>
2N/A#include <libscf.h>
2N/A#include <limits.h>
2N/A#include <strings.h>
2N/A#include <sys/corectl.h>
2N/A#include <sys/resource.h>
2N/A#include <sys/types.h>
2N/A#include <unistd.h>
2N/A#include <fm/diagcode.h>
2N/A#include <fm/fmd_msg.h>
2N/A#include <fm/libfmevent.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define ND_DICTDIR "usr/lib/fm/dict"
2N/A#define ND_UNKNOWN "UNKNOWN"
2N/A
2N/Atypedef struct nd_hdl {
2N/A boolean_t nh_debug;
2N/A boolean_t nh_is_daemon;
2N/A /* handle for libfmevent calls */
2N/A fmev_shdl_t nh_evhdl;
2N/A /* handle for libfmd_msg calls */
2N/A fmd_msg_hdl_t *nh_msghdl;
2N/A FILE *nh_log_fd;
2N/A char *nh_rootdir;
2N/A const char *nh_pname;
2N/A} nd_hdl_t;
2N/A
2N/Aconst char FMNOTIFY_MSG_DOMAIN[] = "FMNOTIFY";
2N/A
2N/Atypedef struct nd_ev_info {
2N/A fmev_t ei_ev;
2N/A const char *ei_class;
2N/A char *ei_descr;
2N/A char *ei_severity;
2N/A char *ei_diagcode;
2N/A char *ei_url;
2N/A char *ei_uuid;
2N/A char *ei_fmri;
2N/A char *ei_from_state;
2N/A char *ei_to_state;
2N/A char *ei_reason;
2N/A nvlist_t *ei_payload;
2N/A} nd_ev_info_t;
2N/A
2N/A
2N/Avoid nd_cleanup(nd_hdl_t *);
2N/Avoid nd_dump_nvlist(nd_hdl_t *, nvlist_t *);
2N/Avoid nd_debug(nd_hdl_t *, const char *, ...);
2N/Avoid nd_error(nd_hdl_t *, const char *, ...);
2N/Avoid nd_abort(nd_hdl_t *, const char *, ...);
2N/Avoid nd_daemonize(nd_hdl_t *);
2N/Aint nd_get_boolean_prop(nd_hdl_t *, const char *, const char *, const char *,
2N/A uint8_t *);
2N/Aint nd_get_astring_prop(nd_hdl_t *, const char *, const char *, const char *,
2N/A char **);
2N/Achar *nd_get_event_fmri(nd_hdl_t *, fmev_t);
2N/Aint nd_get_event_info(nd_hdl_t *, const char *, fmev_t, nd_ev_info_t **);
2N/Aint nd_get_notify_prefs(nd_hdl_t *, const char *, fmev_t, nvlist_t ***,
2N/A uint_t *);
2N/Aint nd_split_list(nd_hdl_t *, char *, char *, char ***, uint_t *);
2N/Aint nd_join_strarray(nd_hdl_t *, char **, uint_t, char **);
2N/Aint nd_merge_strarray(nd_hdl_t *, char **, uint_t, char **, uint_t, char ***);
2N/Avoid nd_free_event_info(nd_ev_info_t *);
2N/Avoid nd_free_nvlarray(nvlist_t **, uint_t);
2N/Avoid nd_free_strarray(char **, uint_t);
2N/Aint nd_get_diagcode(nd_hdl_t *, const char *, const char *, char *, size_t);
2N/A
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _LIBFMNOTIFY_H */