pacemaker  1.1.18-7fdfbbe
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 (C) 2004 Andrew Beekhof <andrew@beekhof.net>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This software is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
25 #ifndef CIB__H
26 # define CIB__H
27 
28 # include <crm/common/ipc.h>
29 # include <crm/common/xml.h>
30 
31 # define CIB_FEATURE_SET "2.0"
32 
33 /* use compare_version() for doing comparisons */
34 
41 };
42 
43 enum cib_state {
47 };
48 
54 };
55 
56 /* *INDENT-OFF* */
58  cib_none = 0x00000000,
59  cib_verbose = 0x00000001,
60  cib_xpath = 0x00000002,
61  cib_multiple = 0x00000004,
62  cib_can_create = 0x00000008,
63  cib_discard_reply = 0x00000010,
64  cib_no_children = 0x00000020,
65  cib_xpath_address = 0x00000040,
66  cib_mixed_update = 0x00000080,
67  cib_scope_local = 0x00000100,
68  cib_dryrun = 0x00000200,
69  cib_sync_call = 0x00001000,
70  cib_no_mtime = 0x00002000,
71  cib_zero_copy = 0x00004000,
72  cib_inhibit_notify = 0x00010000,
73  cib_quorum_override = 0x00100000,
74  cib_inhibit_bcast = 0x01000000, /* TODO: Remove */
75  cib_force_diff = 0x10000000
76 };
77 
78 #define cib_default_options = cib_none
79 #define T_CIB_DIFF_NOTIFY "cib_diff_notify"
80 
81 /* *INDENT-ON* */
82 
83 typedef struct cib_s cib_t;
84 
85 typedef struct cib_api_operations_s {
86  int (*signon) (cib_t * cib, const char *name, enum cib_conn_type type);
87  int (*signon_raw) (cib_t * cib, const char *name, enum cib_conn_type type, int *event_fd);
88  int (*signoff) (cib_t * cib);
89  int (*free) (cib_t * cib);
90 
91  int (*set_op_callback) (cib_t * cib, void (*callback) (const xmlNode * msg, int callid,
92  int rc, xmlNode * output));
93 
94  int (*add_notify_callback) (cib_t * cib, const char *event,
95  void (*callback) (const char *event, xmlNode * msg));
96 
97  int (*del_notify_callback) (cib_t * cib, const char *event,
98  void (*callback) (const char *event, xmlNode * msg));
99 
100  int (*set_connection_dnotify) (cib_t * cib, void (*dnotify) (gpointer user_data));
101 
102  int (*inputfd) (cib_t * cib);
103 
104  int (*noop) (cib_t * cib, int call_options);
105  int (*ping) (cib_t * cib, xmlNode ** output_data, int call_options);
106 
107  int (*query) (cib_t * cib, const char *section, xmlNode ** output_data, int call_options);
108  int (*query_from) (cib_t * cib, const char *host, const char *section,
109  xmlNode ** output_data, int call_options);
110 
111  int (*is_master) (cib_t * cib);
112  int (*set_master) (cib_t * cib, int call_options);
113  int (*set_slave) (cib_t * cib, int call_options);
114  int (*set_slave_all) (cib_t * cib, int call_options);
115 
116  int (*sync) (cib_t * cib, const char *section, int call_options);
117  int (*sync_from) (cib_t * cib, const char *host, const char *section, int call_options);
118 
119  int (*upgrade) (cib_t * cib, int call_options);
120  int (*bump_epoch) (cib_t * cib, int call_options);
121 
122  int (*create) (cib_t * cib, const char *section, xmlNode * data, int call_options);
123  int (*modify) (cib_t * cib, const char *section, xmlNode * data, int call_options);
124  int (*update) (cib_t * cib, const char *section, xmlNode * data, int call_options);
125  int (*replace) (cib_t * cib, const char *section, xmlNode * data, int call_options);
126  int (*delete) (cib_t * cib, const char *section, xmlNode * data, int call_options);
127 
128  int (*erase) (cib_t * cib, xmlNode ** output_data, int call_options);
129  int (*delete_absolute) (cib_t * cib, const char *section, xmlNode * data, int call_options);
130 
131  int (*quit) (cib_t * cib, int call_options);
132 
133  int (*register_notification) (cib_t * cib, const char *callback, int enabled);
134 
135  gboolean(*register_callback) (cib_t * cib, int call_id, int timeout, gboolean only_success,
136  void *user_data, const char *callback_name,
137  void (*callback) (xmlNode *, int, int, xmlNode *, void *));
138 
139  gboolean (*register_callback_full)(cib_t *cib, int call_id, int timeout,
140  gboolean only_success, void *user_data,
141  const char *callback_name,
142  void (*callback)(xmlNode *, int, int,
143  xmlNode *, void *),
144  void (*free_func)(void *));
145 
147 
148 struct cib_s {
152 
153  int call_id;
156  void *delegate_fn;
157 
158  GList *notify_list;
159  void (*op_callback) (const xmlNode * msg, int call_id, int rc, xmlNode * output);
160 
162 };
163 
164 /* Core functions */
165 cib_t *cib_new(void);
166 cib_t *cib_native_new(void);
167 cib_t *cib_file_new(const char *filename);
168 cib_t *cib_remote_new(const char *server, const char *user, const char *passwd, int port,
169  gboolean encrypted);
170 
171 cib_t *cib_new_no_shadow(void);
172 char *get_shadow_file(const char *name);
173 cib_t *cib_shadow_new(const char *name);
174 
175 void cib_free_callbacks(cib_t *cib);
176 void cib_delete(cib_t * cib);
177 
178 void cib_dump_pending_callbacks(void);
179 int num_cib_op_callbacks(void);
180 void remove_cib_op_callback(int call_id, gboolean all_callbacks);
181 
182 /* Deprecated */
183 # define add_cib_op_callback(cib, id, flag, data, fn) do { \
184  cib->cmds->register_callback(cib, id, 120, flag, data, #fn, fn); \
185  } while(0)
186 # include <crm/cib/util.h>
187 
188 # define CIB_LIBRARY "libcib.so.4"
189 
190 #endif
int(* query)(cib_t *cib, const char *section, xmlNode **output_data, int call_options)
Definition: cib.h:107
cib_t * cib_shadow_new(const char *name)
Definition: cib_client.c:279
cib_t * cib_remote_new(const char *server, const char *user, const char *passwd, int port, gboolean encrypted)
Definition: cib_remote.c:115
int call_timeout
Definition: cib.h:154
cib_call_options
Definition: cib.h:57
cib_t * cib_new(void)
Definition: cib_client.c:301
int(* set_slave)(cib_t *cib, int call_options)
Definition: cib.h:113
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:139
int(* free)(cib_t *cib)
Definition: cib.h:89
void remove_cib_op_callback(int call_id, gboolean all_callbacks)
Definition: cib_client.c:652
int(* inputfd)(cib_t *cib)
Definition: cib.h:102
AIS_Host host
Definition: internal.h:52
int(* signon_raw)(cib_t *cib, const char *name, enum cib_conn_type type, int *event_fd)
Definition: cib.h:87
int(* noop)(cib_t *cib, int call_options)
Definition: cib.h:104
int(* set_slave_all)(cib_t *cib, int call_options)
Definition: cib.h:114
int(* set_op_callback)(cib_t *cib, void(*callback)(const xmlNode *msg, int callid, int rc, xmlNode *output))
Definition: cib.h:91
int(* replace)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib.h:125
int(* set_connection_dnotify)(cib_t *cib, void(*dnotify)(gpointer user_data))
Definition: cib.h:100
int(* update)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib.h:124
char * get_shadow_file(const char *name)
Definition: cib_client.c:219
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:135
Definition: cib.h:60
void cib_delete(cib_t *cib)
Free all memory used by CIB connection.
Definition: cib_client.c:437
Definition: cib.h:58
int(* add_notify_callback)(cib_t *cib, const char *event, void(*callback)(const char *event, xmlNode *msg))
Definition: cib.h:94
int(* bump_epoch)(cib_t *cib, int call_options)
Definition: cib.h:120
int(* modify)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib.h:123
struct cib_api_operations_s cib_api_operations_t
Definition: cib.h:51
int(* upgrade)(cib_t *cib, int call_options)
Definition: cib.h:119
cib_api_operations_t * cmds
Definition: cib.h:161
void cib_free_callbacks(cib_t *cib)
Free all callbacks for a CIB connection.
Definition: cib_client.c:415
int(* quit)(cib_t *cib, int call_options)
Definition: cib.h:131
cib_variant
Definition: cib.h:35
int(* ping)(cib_t *cib, xmlNode **output_data, int call_options)
Definition: cib.h:105
void(* op_callback)(const xmlNode *msg, int call_id, int rc, xmlNode *output)
Definition: cib.h:159
int(* register_notification)(cib_t *cib, const char *callback, int enabled)
Definition: cib.h:133
int(* delete_absolute)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib.h:129
int(* erase)(cib_t *cib, xmlNode **output_data, int call_options)
Definition: cib.h:128
Wrappers for and extensions to libxml2.
int(* set_master)(cib_t *cib, int call_options)
Definition: cib.h:112
int(* query_from)(cib_t *cib, const char *host, const char *section, xmlNode **output_data, int call_options)
Definition: cib.h:108
int(* sync_from)(cib_t *cib, const char *host, const char *section, int call_options)
Definition: cib.h:117
cib_t * cib_native_new(void)
Definition: cib_native.c:59
int num_cib_op_callbacks(void)
Definition: cib_client.c:664
Definition: cib.h:38
int(* sync)(cib_t *cib, const char *section, int call_options)
Definition: cib.h:116
Definition: cib.h:68
void * variant_opaque
Definition: cib.h:155
int(* del_notify_callback)(cib_t *cib, const char *event, void(*callback)(const char *event, xmlNode *msg))
Definition: cib.h:97
cib_t * cib_file_new(const char *filename)
Definition: cib_file.c:477
cib_conn_type
Definition: cib.h:49
cib_state
Definition: cib.h:43
Definition: cib.h:39
int(* signon)(cib_t *cib, const char *name, enum cib_conn_type type)
Definition: cib.h:86
Definition: cib.h:37
char data[0]
Definition: internal.h:58
enum cib_variant variant
Definition: cib.h:151
cib_t * cib_new_no_shadow(void)
Definition: cib_client.c:294
int(* is_master)(cib_t *cib)
Definition: cib.h:111
Wrappers for and extensions to libqb IPC.
int call_id
Definition: cib.h:153
int(* create)(cib_t *cib, const char *section, xmlNode *data, int call_options)
Definition: cib.h:122
int(* signoff)(cib_t *cib)
Definition: cib.h:88
void cib_dump_pending_callbacks(void)
Definition: cib_client.c:682
enum cib_conn_type type
Definition: cib.h:150
enum cib_state state
Definition: cib.h:149
GList * notify_list
Definition: cib.h:158
Definition: cib.h:148
void * delegate_fn
Definition: cib.h:156
enum crm_ais_msg_types type
Definition: internal.h:51