1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef PENGINE_UNPACK__H
19 # define PENGINE_UNPACK__H
20
21 extern gboolean unpack_remote_nodes(xmlNode * xml_resources, pe_working_set_t * data_set);
22
23 extern gboolean unpack_resources(xmlNode * xml_resources, pe_working_set_t * data_set);
24
25 extern gboolean unpack_config(xmlNode * config, pe_working_set_t * data_set);
26
27 extern gboolean unpack_nodes(xmlNode * xml_nodes, pe_working_set_t * data_set);
28
29 extern gboolean unpack_tags(xmlNode * xml_tags, pe_working_set_t * data_set);
30
31 extern gboolean unpack_status(xmlNode * status, pe_working_set_t * data_set);
32
33 extern gboolean unpack_remote_status(xmlNode * status, pe_working_set_t * data_set);
34
35 extern gint sort_op_by_callid(gconstpointer a, gconstpointer b);
36
37 extern gboolean unpack_lrm_resources(node_t * node, xmlNode * lrm_state,
38 pe_working_set_t * data_set);
39
40 extern gboolean add_node_attrs(xmlNode * attrs, node_t * node, gboolean overwrite,
41 pe_working_set_t * data_set);
42
43 extern gboolean determine_online_status(xmlNode * node_state, node_t * this_node,
44 pe_working_set_t * data_set);
45
46
47
48
49
50
51 # if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBCURSES)
52 # if defined(HAVE_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
53 # include <ncurses.h>
54 # define CURSES_ENABLED 1
55 # elif defined(HAVE_NCURSES_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
56 # include <ncurses/ncurses.h>
57 # define CURSES_ENABLED 1
58 # elif defined(HAVE_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
59 # include <curses.h>
60 # define CURSES_ENABLED 1
61 # elif defined(HAVE_CURSES_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
62 # include <curses/curses.h>
63 # define CURSES_ENABLED 1
64 # else
65 # define CURSES_ENABLED 0
66 # endif
67 # else
68 # define CURSES_ENABLED 0
69 # endif
70
71 # if CURSES_ENABLED
72 # define status_printw(fmt, args...) printw(fmt, ##args)
73 # else
74 # define status_printw(fmt, args...) \
75 crm_err("printw support requires ncurses to be available during configure"); \
76 do_crm_log(LOG_WARNING, fmt, ##args);
77 # endif
78
79 # define status_print(fmt, args...) \
80 if(options & pe_print_html) { \
81 FILE *stream = print_data; \
82 fprintf(stream, fmt, ##args); \
83 } else if(options & pe_print_ncurses) { \
84 status_printw(fmt, ##args); \
85 } else if(options & pe_print_printf) { \
86 FILE *stream = print_data; \
87 fprintf(stream, fmt, ##args); \
88 } else if(options & pe_print_xml) { \
89 FILE *stream = print_data; \
90 fprintf(stream, fmt, ##args); \
91 } else if(options & pe_print_log) { \
92 int log_level = *(int*)print_data; \
93 do_crm_log(log_level, fmt, ##args); \
94 }
95
96
97
98 enum pe_warn_once_e {
99 pe_wo_blind = 0x0001,
100 pe_wo_poweroff = 0x0002,
101 pe_wo_arg_map = 0x0004,
102 pe_wo_stonith_cmd = 0x0008,
103 pe_wo_requires = 0x0010,
104 pe_wo_isolation = 0x0020,
105 pe_wo_default_stick = 0x0040,
106 pe_wo_default_isman = 0x0080,
107 pe_wo_default_timeo = 0x0100,
108 pe_wo_rsc_failstick = 0x0200,
109 pe_wo_default_rscfs = 0x0400,
110 pe_wo_legacy_notifs = 0x0800,
111 };
112
113 extern uint32_t pe_wo;
114
115 #define pe_warn_once(pe_wo_bit, fmt...) do { \
116 if (is_not_set(pe_wo, pe_wo_bit)) { \
117 if (pe_wo_bit == pe_wo_blind) { \
118 crm_warn(fmt); \
119 } else { \
120 pe_warn(fmt); \
121 } \
122 set_bit(pe_wo, pe_wo_bit); \
123 } \
124 } while (0);
125
126 #endif