root/tools/crm_mon.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright 2019-2023 the Pacemaker project contributors
   3  *
   4  * The version control history for this file may have further details.
   5  *
   6  * This source code is licensed under the GNU General Public License version 2
   7  * or later (GPLv2+) WITHOUT ANY WARRANTY.
   8  */
   9 
  10 #ifndef CRM_MON__H
  11 #define CRM_MON__H
  12 
  13 #include <crm_internal.h>
  14 
  15 #include <glib.h>
  16 
  17 #include <crm/common/output_internal.h>
  18 #include <crm/pengine/pe_types.h>
  19 #include <crm/stonith-ng.h>
  20 
  21 /*
  22  * The man pages for both curses and ncurses suggest inclusion of "curses.h".
  23  * We believe the following to be acceptable and portable.
  24  */
  25 
  26 #  if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBCURSES)
  27 #    if defined(HAVE_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
  28 #      include <ncurses.h>
  29 #      define CURSES_ENABLED 1
  30 #    elif defined(HAVE_NCURSES_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
  31 #      include <ncurses/ncurses.h>
  32 #      define CURSES_ENABLED 1
  33 #    elif defined(HAVE_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
  34 #      include <curses.h>
  35 #      define CURSES_ENABLED 1
  36 #    elif defined(HAVE_CURSES_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
  37 #      include <curses/curses.h>
  38 #      define CURSES_ENABLED 1
  39 #    else
  40 #      define CURSES_ENABLED 0
  41 #    endif
  42 #  else
  43 #    define CURSES_ENABLED 0
  44 #  endif
  45 
  46 typedef enum mon_output_format_e {
  47     mon_output_unset,
  48     mon_output_none,
  49     mon_output_monitor,
  50     mon_output_plain,
  51     mon_output_console,
  52     mon_output_xml,
  53     mon_output_legacy_xml,
  54     mon_output_html,
  55     mon_output_cgi
  56 } mon_output_format_t;
  57 
  58 enum mon_exec_mode {
  59     mon_exec_unset,
  60     mon_exec_daemonized,
  61     mon_exec_one_shot,
  62     mon_exec_update,
  63 };
  64 
  65 void crm_mon_register_messages(pcmk__output_t *out);
  66 
  67 #if CURSES_ENABLED
  68 pcmk__output_t *crm_mon_mk_curses_output(char **argv);
  69 void curses_formatted_printf(pcmk__output_t *out, const char *format, ...) G_GNUC_PRINTF(2, 3);
  70 void curses_formatted_vprintf(pcmk__output_t *out, const char *format, va_list args) G_GNUC_PRINTF(2, 0);
  71 void curses_indented_printf(pcmk__output_t *out, const char *format, ...) G_GNUC_PRINTF(2, 3);
  72 void curses_indented_vprintf(pcmk__output_t *out, const char *format, va_list args) G_GNUC_PRINTF(2, 0);
  73 
  74 extern GOptionEntry crm_mon_curses_output_entries[];
  75 #define CRM_MON_SUPPORTED_FORMAT_CURSES { "console", crm_mon_mk_curses_output, crm_mon_curses_output_entries }
  76 #endif
  77 
  78 #endif

/* [previous][next][first][last][top][bottom][index][help] */