2
2
* Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
4
4
* This program is free software; you can redistribute it and/or
5
5
* modify it under the terms of the GNU General Public
6
6
* License as published by the Free Software Foundation; either
7
7
* version 2 of the License, or (at your option) any later version.
9
9
* This software is distributed in the hope that it will be useful,
10
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
12
* General Public License for more details.
14
14
* You should have received a copy of the GNU General Public
15
15
* License along with this library; if not, write to the Free Software
16
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
23
#include <crm/crm.h>
24
24
#include <crm/cib.h>
25
25
#include <crm/common/xml.h>
26
#include <crm/common/cluster.h>
26
#include <crm/cluster.h>
27
#include <crm/common/ipcs.h>
28
#include <crm/common/mainloop.h>
29
#ifdef HAVE_GNUTLS_GNUTLS_H
31
# include <gnutls/gnutls.h>
28
34
extern gboolean cib_is_master;
29
extern GHashTable *client_list;
30
35
extern GHashTable *peer_hash;
31
36
extern GHashTable *config_hash;
33
typedef struct cib_client_s {
39
const char *channel_name;
44
unsigned long num_calls;
52
GList *delegated_calls;
39
enum cib_notifications
41
cib_notify_pre = 0x0001,
42
cib_notify_post = 0x0002,
43
cib_notify_replace = 0x0004,
44
cib_notify_confirm = 0x0008,
45
cib_notify_diff = 0x0010,
55
49
typedef struct cib_operation_s {
56
50
const char *operation;
57
51
gboolean modifies_cib;
58
52
gboolean needs_privileges;
59
53
gboolean needs_quorum;
60
enum cib_errors (*prepare) (xmlNode *, xmlNode **, const char **);
61
enum cib_errors (*cleanup) (int, xmlNode **, xmlNode **);
62
enum cib_errors (*fn) (const char *, int, const char *, xmlNode *,
63
xmlNode *, xmlNode *, xmlNode **, xmlNode **);
54
int (*prepare) (xmlNode *, xmlNode **, const char **);
55
int (*cleanup) (int, xmlNode **, xmlNode **);
56
int (*fn) (const char *, int, const char *, xmlNode *,
57
xmlNode *, xmlNode *, xmlNode **, xmlNode **);
66
extern gboolean cib_client_connect(IPC_Channel * channel, gpointer user_data);
67
extern gboolean cib_null_callback(IPC_Channel * channel, gpointer user_data);
68
extern gboolean cib_rw_callback(IPC_Channel * channel, gpointer user_data);
69
extern gboolean cib_ro_callback(IPC_Channel * channel, gpointer user_data);
60
extern struct qb_ipcs_service_handlers ipc_ro_callbacks;
61
extern struct qb_ipcs_service_handlers ipc_rw_callbacks;
62
extern qb_ipcs_service_t *ipcs_ro;
63
extern qb_ipcs_service_t *ipcs_rw;
64
extern qb_ipcs_service_t *ipcs_shm;
71
extern void cib_ha_peer_callback(HA_Message * msg, void *private_data);
72
66
extern void cib_peer_callback(xmlNode * msg, void *private_data);
73
67
extern void cib_client_status_callback(const char *node, const char *client,
74
68
const char *status, void *private);
69
extern void cib_common_callback_worker(uint32_t id, uint32_t flags, xmlNode * op_request,
70
crm_client_t * cib_client, gboolean privileged);
72
void cib_shutdown(int nsig);
73
void initiate_exit(void);
74
void terminate_cib(const char *caller, gboolean fast);
76
76
#if SUPPORT_HEARTBEAT
77
extern gboolean cib_ccm_dispatch(int fd, gpointer user_data);
77
extern void cib_ha_peer_callback(HA_Message * msg, void *private_data);
78
extern int cib_ccm_dispatch(gpointer user_data);
79
79
extern void cib_ccm_msg_callback(oc_ed_t event, void *cookie, size_t size, const void *data);