Print this page
NEX-16536 SUN-IREPORT-MIB is broken
NEX-16537 enhance FM traps
NEX-16545 SMF dict should have obsolete entries removed
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Cynthia Eastham <cynthia.eastham@nexenta.com>
Reviewed by: Alexander Eremin <alexander.eremin@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>


   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) 2010, Oracle and/or its affiliates. All rights reserved.
  24  */





  25 #ifndef _LIBFMNOTIFY_H
  26 #define _LIBFMNOTIFY_H
  27 
  28 #include <stdio.h>
  29 #include <stdlib.h>
  30 #include <string.h>
  31 #include <alloca.h>
  32 #include <errno.h>
  33 #include <libscf.h>
  34 #include <limits.h>
  35 #include <strings.h>
  36 #include <sys/corectl.h>
  37 #include <sys/resource.h>
  38 #include <sys/types.h>
  39 #include <unistd.h>
  40 #include <fm/diagcode.h>
  41 #include <fm/fmd_msg.h>
  42 #include <fm/libfmevent.h>
  43 
  44 #ifdef __cplusplus


  49 #define ND_UNKNOWN "UNKNOWN"
  50 
  51 typedef struct nd_hdl {
  52         boolean_t       nh_debug;
  53         boolean_t       nh_is_daemon;
  54         boolean_t       nh_keep_running;
  55         /* handle for libfmevent calls */
  56         fmev_shdl_t     nh_evhdl;
  57         /* handle for libfmd_msg calls */
  58         fmd_msg_hdl_t   *nh_msghdl;
  59         FILE            *nh_log_fd;
  60         char            *nh_rootdir;
  61         const char      *nh_pname;
  62 } nd_hdl_t;
  63 
  64 const char FMNOTIFY_MSG_DOMAIN[] = "FMNOTIFY";
  65 
  66 typedef struct nd_ev_info {
  67         fmev_t ei_ev;
  68         const char *ei_class;
  69         char *ei_descr;
  70         char *ei_severity;
  71         char *ei_diagcode;


  72         char *ei_url;
  73         char *ei_uuid;
  74         char *ei_fmri;
  75         char *ei_from_state;
  76         char *ei_to_state;
  77         char *ei_reason;
  78         nvlist_t *ei_payload;
  79 } nd_ev_info_t;
  80 
  81 
  82 void nd_cleanup(nd_hdl_t *);
  83 void nd_dump_nvlist(nd_hdl_t *, nvlist_t *);
  84 void nd_debug(nd_hdl_t *, const char *, ...);
  85 void nd_error(nd_hdl_t *, const char *, ...);
  86 void nd_abort(nd_hdl_t *, const char *, ...);
  87 void nd_daemonize(nd_hdl_t *);
  88 int nd_get_boolean_prop(nd_hdl_t *, const char *, const char *, const char *,
  89     uint8_t *);
  90 int nd_get_astring_prop(nd_hdl_t *, const char *, const char *, const char *,
  91     char **);
  92 char *nd_get_event_fmri(nd_hdl_t *, fmev_t);
  93 int nd_get_event_info(nd_hdl_t *, const char *, fmev_t, nd_ev_info_t **);
  94 int nd_get_notify_prefs(nd_hdl_t *, const char *, fmev_t, nvlist_t ***,
  95     uint_t *);
  96 int nd_split_list(nd_hdl_t *, char *, char *, char ***, uint_t *);
  97 int nd_join_strarray(nd_hdl_t *, char **, uint_t, char **);
  98 int nd_merge_strarray(nd_hdl_t *, char **, uint_t, char **, uint_t, char ***);
  99 void nd_free_event_info(nd_ev_info_t *);
 100 void nd_free_nvlarray(nvlist_t **, uint_t);
 101 void nd_free_strarray(char **, uint_t);


   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) 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*
  27  * Copyright 2018 Nexenta Systems, Inc.
  28  */
  29 
  30 #ifndef _LIBFMNOTIFY_H
  31 #define _LIBFMNOTIFY_H
  32 
  33 #include <stdio.h>
  34 #include <stdlib.h>
  35 #include <string.h>
  36 #include <alloca.h>
  37 #include <errno.h>
  38 #include <libscf.h>
  39 #include <limits.h>
  40 #include <strings.h>
  41 #include <sys/corectl.h>
  42 #include <sys/resource.h>
  43 #include <sys/types.h>
  44 #include <unistd.h>
  45 #include <fm/diagcode.h>
  46 #include <fm/fmd_msg.h>
  47 #include <fm/libfmevent.h>
  48 
  49 #ifdef __cplusplus


  54 #define ND_UNKNOWN "UNKNOWN"
  55 
  56 typedef struct nd_hdl {
  57         boolean_t       nh_debug;
  58         boolean_t       nh_is_daemon;
  59         boolean_t       nh_keep_running;
  60         /* handle for libfmevent calls */
  61         fmev_shdl_t     nh_evhdl;
  62         /* handle for libfmd_msg calls */
  63         fmd_msg_hdl_t   *nh_msghdl;
  64         FILE            *nh_log_fd;
  65         char            *nh_rootdir;
  66         const char      *nh_pname;
  67 } nd_hdl_t;
  68 
  69 const char FMNOTIFY_MSG_DOMAIN[] = "FMNOTIFY";
  70 
  71 typedef struct nd_ev_info {
  72         fmev_t ei_ev;
  73         const char *ei_class;
  74         char *ei_uuid;

  75         char *ei_diagcode;
  76         char *ei_type;
  77         char *ei_severity;
  78         char *ei_url;
  79         char *ei_descr;
  80         char *ei_fmri;
  81         char *ei_from_state;
  82         char *ei_to_state;
  83         char *ei_reason;
  84         nvlist_t *ei_payload;
  85 } nd_ev_info_t;
  86 

  87 void nd_cleanup(nd_hdl_t *);
  88 void nd_dump_nvlist(nd_hdl_t *, nvlist_t *);
  89 void nd_debug(nd_hdl_t *, const char *, ...);
  90 void nd_error(nd_hdl_t *, const char *, ...);
  91 void nd_abort(nd_hdl_t *, const char *, ...);
  92 void nd_daemonize(nd_hdl_t *);
  93 int nd_get_boolean_prop(nd_hdl_t *, const char *, const char *, const char *,
  94     uint8_t *);
  95 int nd_get_astring_prop(nd_hdl_t *, const char *, const char *, const char *,
  96     char **);
  97 char *nd_get_event_fmri(nd_hdl_t *, fmev_t);
  98 int nd_get_event_info(nd_hdl_t *, const char *, fmev_t, nd_ev_info_t **);
  99 int nd_get_notify_prefs(nd_hdl_t *, const char *, fmev_t, nvlist_t ***,
 100     uint_t *);
 101 int nd_split_list(nd_hdl_t *, char *, char *, char ***, uint_t *);
 102 int nd_join_strarray(nd_hdl_t *, char **, uint_t, char **);
 103 int nd_merge_strarray(nd_hdl_t *, char **, uint_t, char **, uint_t, char ***);
 104 void nd_free_event_info(nd_ev_info_t *);
 105 void nd_free_nvlarray(nvlist_t **, uint_t);
 106 void nd_free_strarray(char **, uint_t);