This source file includes following definitions.
- crm_alert_flag2text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef ALERT_INTERNAL_H
20 #define ALERT_INTERNAL_H
21
22 #include <glib.h>
23 #include <stdbool.h>
24
25
26 # define CRM_ALERT_DEFAULT_TIMEOUT_MS (30000)
27
28
29 # define CRM_ALERT_DEFAULT_TSTAMP_FORMAT "%H:%M:%S.%06N"
30
31 typedef struct {
32 char *name;
33 char *value;
34 } crm_alert_envvar_t;
35
36 enum crm_alert_flags {
37 crm_alert_none = 0x0000,
38 crm_alert_node = 0x0001,
39 crm_alert_fencing = 0x0002,
40 crm_alert_resource = 0x0004,
41 crm_alert_attribute = 0x0008,
42 crm_alert_default = crm_alert_node|crm_alert_fencing|crm_alert_resource
43 };
44
45 typedef struct {
46 char *id;
47 char *path;
48 char *tstamp_format;
49 char *recipient;
50 char **select_attribute_name;
51 GHashTable *envvars;
52 int timeout;
53 uint32_t flags;
54 } crm_alert_entry_t;
55
56 enum crm_alert_keys_e {
57 CRM_alert_recipient = 0,
58 CRM_alert_node,
59 CRM_alert_nodeid,
60 CRM_alert_rsc,
61 CRM_alert_task,
62 CRM_alert_interval,
63 CRM_alert_desc,
64 CRM_alert_status,
65 CRM_alert_target_rc,
66 CRM_alert_rc,
67 CRM_alert_kind,
68 CRM_alert_version,
69 CRM_alert_node_sequence,
70 CRM_alert_timestamp,
71 CRM_alert_attribute_name,
72 CRM_alert_attribute_value,
73 CRM_alert_select_kind,
74 CRM_alert_select_attribute_name
75 };
76
77 #define CRM_ALERT_INTERNAL_KEY_MAX 16
78 #define CRM_ALERT_NODE_SEQUENCE "CRM_alert_node_sequence"
79
80 extern const char *crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3];
81
82 crm_alert_entry_t *crm_dup_alert_entry(crm_alert_entry_t *entry);
83 crm_alert_envvar_t *crm_dup_alert_envvar(crm_alert_envvar_t *src);
84 crm_alert_entry_t *crm_alert_entry_new(const char *id, const char *path);
85 void crm_free_alert_entry(crm_alert_entry_t *entry);
86 void crm_free_alert_envvar(crm_alert_envvar_t *entry);
87 void crm_insert_alert_key(GHashTable *table, enum crm_alert_keys_e name,
88 const char *value);
89 void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name,
90 int value);
91 void crm_unset_alert_keys(void);
92 void crm_set_envvar_list(crm_alert_entry_t *entry);
93 void crm_unset_envvar_list(crm_alert_entry_t *entry);
94 bool crm_patchset_contains_alert(xmlNode *msg, bool config);
95
96 static inline const char *
97 crm_alert_flag2text(enum crm_alert_flags flag)
98 {
99 switch (flag) {
100 case crm_alert_node:
101 return "node";
102 case crm_alert_fencing:
103 return "fencing";
104 case crm_alert_resource:
105 return "resource";
106 case crm_alert_attribute:
107 return "attribute";
108 default:
109 return "unknown";
110 }
111 }
112 #endif