pacemaker  2.0.2-debe490
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cib.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2019 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 Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #ifndef CIB__H
11 # define CIB__H
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
23 # include <glib.h> // gboolean, GList
24 # include <libxml/tree.h> // xmlNode
25 # include <crm/common/ipc.h>
26 # include <crm/common/xml.h>
27 
28 # define CIB_FEATURE_SET "2.0"
29 
30 /* use compare_version() for doing comparisons */
31 
38 };
39 
40 enum cib_state {
44 };
45 
51 };
52 
53 /* *INDENT-OFF* */
55  cib_none = 0x00000000,
56  cib_verbose = 0x00000001, /* prefer stderr to logs */
57  cib_xpath = 0x00000002,
58  cib_multiple = 0x00000004,
59  cib_can_create = 0x00000008,
60  cib_discard_reply = 0x00000010,
61  cib_no_children = 0x00000020,
62  cib_xpath_address = 0x00000040,
63  cib_mixed_update = 0x00000080,
64  cib_scope_local = 0x00000100,
65  cib_dryrun = 0x00000200,
66  cib_sync_call = 0x00001000,
67  cib_no_mtime = 0x00002000,
68  cib_zero_copy = 0x00004000,
69  cib_inhibit_notify = 0x00010000,
70  cib_quorum_override = 0x00100000,
71  cib_inhibit_bcast = 0x01000000, /* TODO: Remove */
72  cib_force_diff = 0x10000000
73 };
74 
75 #define T_CIB_DIFF_NOTIFY "cib_diff_notify"
76 
77 /* *INDENT-ON* */
78 
79 typedef struct cib_s cib_t;
80 
81 typedef struct cib_api_operations_s {
82  int (*signon) (cib_t * cib, const char *name, enum cib_conn_type type);
83  int (*signon_raw) (cib_t * cib, const char *name, enum cib_conn_type type, int *event_fd);
84  int (*signoff) (cib_t * cib);
85  int (*free) (cib_t * cib);
86 
87  int (*set_op_callback) (cib_t * cib, void (*callback) (const xmlNode * msg, int callid,
88  int rc, xmlNode * output));
89 
90  int (*add_notify_callback) (cib_t * cib, const char *event,
91  void (*callback) (const char *event, xmlNode * msg));
92 
93  int (*del_notify_callback) (cib_t * cib, const char *event,
94  void (*callback) (const char *event, xmlNode * msg));
95 
96  int (*set_connection_dnotify) (cib_t * cib, void (*dnotify) (gpointer user_data));
97 
98  int (*inputfd) (cib_t * cib);
99 
100  int (*noop) (cib_t * cib, int call_options);
101  int (*ping) (cib_t * cib, xmlNode ** output_data, int call_options);
102 
103  int (*query) (cib_t * cib, const char *section, xmlNode ** output_data, int call_options);
104  int (*query_from) (cib_t * cib, const char *host, const char *section,
105  xmlNode ** output_data, int call_options);
106 
107  int (*is_master) (cib_t * cib);
108  int (*set_master) (cib_t * cib, int call_options);
109  int (*set_slave) (cib_t * cib, int call_options);
110  int (*set_slave_all) (cib_t * cib, int call_options);
111 
112  int (*sync) (cib_t * cib, const char *section, int call_options);
113  int (*sync_from) (cib_t * cib, const char *host, const char *section, int call_options);
114 
115  int (*upgrade) (cib_t * cib, int call_options);
116  int (*bump_epoch) (cib_t * cib, int call_options);
117 
118  int (*create) (cib_t * cib, const char *section, xmlNode * data, int call_options);
119  int (*modify) (cib_t * cib, const char *section, xmlNode * data, int call_options);
120  int (*update) (cib_t * cib, const char *section, xmlNode * data, int call_options);
121  int (*replace) (cib_t * cib, const char *section, xmlNode * data, int call_options);
122  int (*remove) (cib_t * cib, const char *section, xmlNode * data, int call_options);
123 
124  int (*erase) (cib_t * cib, xmlNode ** output_data, int call_options);
125  int (*delete_absolute) (cib_t * cib, const char *section, xmlNode * data, int call_options);
126 
127  int (*quit) (cib_t * cib, int call_options);
128 
129  int (*register_notification) (cib_t * cib, const char *callback, int enabled);
130 
131  gboolean(*register_callback) (cib_t * cib, int call_id, int timeout, gboolean only_success,
132  void *user_data, const char *callback_name,
133  void (*callback) (xmlNode *, int, int, xmlNode *, void *));
134 
135  gboolean (*register_callback_full)(cib_t *cib, int call_id, int timeout,
136  gboolean only_success, void *user_data,
137  const char *callback_name,
138  void (*callback)(xmlNode *, int, int,
139  xmlNode *, void *),
140  void (*free_func)(void *));
141 
143 
144 struct cib_s {
148 
149  int call_id;
152  void *delegate_fn;
153 
154  GList *notify_list;
155  void (*op_callback) (const xmlNode * msg, int call_id, int rc, xmlNode * output);
156 
158 };
159 
160 /* Core functions */
161 cib_t *cib_new(void);
162 cib_t *cib_native_new(void);
163 cib_t *cib_file_new(const char *filename);
164 cib_t *cib_remote_new(const char *server, const char *user, const char *passwd, int port,
165  gboolean encrypted);
166 
167 cib_t *cib_new_no_shadow(void);
168 char *get_shadow_file(const char *name);
169 cib_t *cib_shadow_new(const char *name);
170 
171 void cib_free_callbacks(cib_t *cib);
172 void cib_delete(cib_t * cib);
173 
174 void cib_dump_pending_callbacks(void);
175 int num_cib_op_callbacks(void);
176 void remove_cib_op_callback(int call_id, gboolean all_callbacks);
177 
178 # include <crm/cib/util.h>
179 
180 # define CIB_LIBRARY "libcib.so.27"
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 
186 #endif
int(* query)(cib_t *cib, const char *section, xmlNode **output_data, int call_options)
Definition: cib.h:103
cib_t * cib_shadow_new(const char *name)
Definition: cib_client.c:268
cib_t * cib_remote_new(const char *server, const char *user, const char *passwd, int port, gboolean encrypted)
Definition: cib_remote.c:105
int call_timeout
Definition: cib.h:150
cib_call_options
Definition: cib.h:54
cib_t * cib_new(void)
Definition: cib_client.c:290
int(* set_slave)(cib_t *cib, int call_options)
Definition: cib.h:109
gboolean(* register_callback_full)(cib_t *cib, int call_id, int timeout, gboolean only_success, void *user_data, const char *callback_name, void(*callback)(xmlNode *, int, int, xmlNode *, void *), void(*free_func)(void *))
Definition: cib.h:135
int(* free)(cib_t *cib)
Definition: cib.h:85
void remove_cib_op_callback(int call_id, gboolean all_callbacks)
Definition: cib_client.c:641
int(* inputfd)(cib_t *cib)
Definition: cib.h:98
AIS_Host host
Definition: internal.h:86
int(* signon_raw)(cib_t *cib, const char *name, enum cib_conn_type type, int *event_fd)
Definition: cib.h:83
int(* noop)(cib_t *cib, int call_options)
Definition: cib.h:100
int(* set_slave_all)(cib_t *cib, int call_options)
Definition: cib.h:110
int(* set_op_callback)(cib_t *cib, void(*callback)(const xmlNode *msg, int callid, int rc, xmlNode *output))
Definition: cib.h:87
int(* replace)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib.h:121
int(* set_connection_dnotify)(cib_t *cib, void(*dnotify)(gpointer user_data))
Definition: cib.h:96
int(* update)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib.h:120
char * get_shadow_file(const char *name)
Definition: cib_client.c:208
gboolean(* register_callback)(cib_t *cib, int call_id, int timeout, gboolean only_success, void *user_data, const char *callback_name, void(*callback)(xmlNode *, int, int, xmlNode *, void *))
Definition: cib.h:131
Definition: cib.h:57
void cib_delete(cib_t *cib)
Free all memory used by CIB connection.
Definition: cib_client.c:426
Definition: cib.h:55
int(* add_notify_callback)(cib_t *cib, const char *event, void(*callback)(const char *event, xmlNode *msg))
Definition: cib.h:90
int(* bump_epoch)(cib_t *cib, int call_options)
Definition: cib.h:116
int(* modify)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib.h:119
struct cib_api_operations_s cib_api_operations_t
Definition: cib.h:48
int(* upgrade)(cib_t *cib, int call_options)
Definition: cib.h:115
cib_api_operations_t * cmds
Definition: cib.h:157
void cib_free_callbacks(cib_t *cib)
Free all callbacks for a CIB connection.
Definition: cib_client.c:404
int(* quit)(cib_t *cib, int call_options)
Definition: cib.h:127
cib_variant
Definition: cib.h:32
int(* ping)(cib_t *cib, xmlNode **output_data, int call_options)
Definition: cib.h:101
void(* op_callback)(const xmlNode *msg, int call_id, int rc, xmlNode *output)
Definition: cib.h:155
int(* register_notification)(cib_t *cib, const char *callback, int enabled)
Definition: cib.h:129
int(* delete_absolute)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib.h:125
int(* erase)(cib_t *cib, xmlNode **output_data, int call_options)
Definition: cib.h:124
Wrappers for and extensions to libxml2.
int(* set_master)(cib_t *cib, int call_options)
Definition: cib.h:108
int(* query_from)(cib_t *cib, const char *host, const char *section, xmlNode **output_data, int call_options)
Definition: cib.h:104
int(* sync_from)(cib_t *cib, const char *host, const char *section, int call_options)
Definition: cib.h:113
cib_t * cib_native_new(void)
Definition: cib_native.c:56
int num_cib_op_callbacks(void)
Definition: cib_client.c:653
Definition: cib.h:35
int(* sync)(cib_t *cib, const char *section, int call_options)
Definition: cib.h:112
Definition: cib.h:65
void * variant_opaque
Definition: cib.h:151
int(* del_notify_callback)(cib_t *cib, const char *event, void(*callback)(const char *event, xmlNode *msg))
Definition: cib.h:93
cib_t * cib_file_new(const char *filename)
Definition: cib_file.c:459
cib_conn_type
Definition: cib.h:46
cib_state
Definition: cib.h:40
Definition: cib.h:36
int(* signon)(cib_t *cib, const char *name, enum cib_conn_type type)
Definition: cib.h:82
Definition: cib.h:34
char data[0]
Definition: internal.h:92
enum cib_variant variant
Definition: cib.h:147
cib_t * cib_new_no_shadow(void)
Definition: cib_client.c:283
int(* is_master)(cib_t *cib)
Definition: cib.h:107
Wrappers for and extensions to libqb IPC.
int call_id
Definition: cib.h:149
int(* create)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib.h:118
int(* signoff)(cib_t *cib)
Definition: cib.h:84
void cib_dump_pending_callbacks(void)
Definition: cib_client.c:671
enum cib_conn_type type
Definition: cib.h:146
enum cib_state state
Definition: cib.h:145
GList * notify_list
Definition: cib.h:154
Definition: cib.h:144
void * delegate_fn
Definition: cib.h:152
enum crm_ais_msg_types type
Definition: internal.h:85