This source file includes following definitions.
- pcmk__alert_flag2text
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__ALERT_INTERNAL__H
11 #define PCMK__ALERT_INTERNAL__H
12
13 #include <glib.h>
14 #include <stdbool.h>
15
16
17 #define PCMK__ALERT_DEFAULT_TIMEOUT_MS (30000)
18
19
20 #define PCMK__ALERT_DEFAULT_TSTAMP_FORMAT "%H:%M:%S.%06N"
21
22 enum pcmk__alert_flags {
23 pcmk__alert_none = 0,
24 pcmk__alert_node = (1 << 0),
25 pcmk__alert_fencing = (1 << 1),
26 pcmk__alert_resource = (1 << 2),
27 pcmk__alert_attribute = (1 << 3),
28 pcmk__alert_default = pcmk__alert_node|pcmk__alert_fencing|
29 pcmk__alert_resource,
30 };
31
32 typedef struct {
33 char *id;
34 char *path;
35 char *tstamp_format;
36 char *recipient;
37 char **select_attribute_name;
38 GHashTable *envvars;
39 int timeout;
40 uint32_t flags;
41 } pcmk__alert_t;
42
43 enum pcmk__alert_keys_e {
44 PCMK__alert_key_recipient = 0,
45 PCMK__alert_key_node,
46 PCMK__alert_key_nodeid,
47 PCMK__alert_key_rsc,
48 PCMK__alert_key_task,
49 PCMK__alert_key_interval,
50 PCMK__alert_key_desc,
51 PCMK__alert_key_status,
52 PCMK__alert_key_target_rc,
53 PCMK__alert_key_rc,
54 PCMK__alert_key_kind,
55 PCMK__alert_key_version,
56 PCMK__alert_key_node_sequence,
57 PCMK__alert_key_timestamp,
58 PCMK__alert_key_attribute_name,
59 PCMK__alert_key_attribute_value,
60 PCMK__alert_key_timestamp_epoch,
61 PCMK__alert_key_timestamp_usec,
62 PCMK__alert_key_exec_time,
63 PCMK__alert_key_select_kind,
64 PCMK__alert_key_select_attribute_name
65 };
66
67 #define PCMK__ALERT_INTERNAL_KEY_MAX 19
68 #define PCMK__ALERT_NODE_SEQUENCE "CRM_alert_node_sequence"
69
70 extern const char *pcmk__alert_keys[PCMK__ALERT_INTERNAL_KEY_MAX][3];
71
72 pcmk__alert_t *pcmk__dup_alert(const pcmk__alert_t *entry);
73 pcmk__alert_t *pcmk__alert_new(const char *id, const char *path);
74 void pcmk__free_alert(pcmk__alert_t *entry);
75 void pcmk__add_alert_key(GHashTable *table, enum pcmk__alert_keys_e name,
76 const char *value);
77 void pcmk__add_alert_key_int(GHashTable *table, enum pcmk__alert_keys_e name,
78 int value);
79
80 static inline const char *
81 pcmk__alert_flag2text(enum pcmk__alert_flags flag)
82 {
83 switch (flag) {
84 case pcmk__alert_node: return "node";
85 case pcmk__alert_fencing: return "fencing";
86 case pcmk__alert_resource: return "resource";
87 case pcmk__alert_attribute: return "attribute";
88 default: return "unknown";
89 }
90 }
91 #endif