| 72 | } |
| 73 | |
| 74 | gboolean |
| 75 | cib_notify_client(gpointer key, gpointer value, gpointer user_data) |
| 76 | { |
| 77 | const char *type = NULL; |
| 78 | gboolean do_send = FALSE; |
| 79 | |
| 80 | cib_client_t *client = value; |
| 81 | xmlNode *update_msg = user_data; |
| 82 | |
| 83 | CRM_CHECK(client != NULL, return TRUE); |
| 84 | CRM_CHECK(update_msg != NULL, return TRUE); |
| 85 | |
| 86 | if (client->ipc == NULL) { |
| 87 | crm_warn("Skipping client with NULL channel"); |
| 88 | return FALSE; |
| 89 | } |
| 90 | |
| 91 | type = crm_element_value(update_msg, F_SUBTYPE); |
| 92 | |
| 93 | CRM_LOG_ASSERT(type != NULL); |
| 94 | if (client->diffs && safe_str_eq(type, T_CIB_DIFF_NOTIFY)) { |
| 95 | do_send = TRUE; |
| 96 | |
| 97 | } else if (client->replace && safe_str_eq(type, T_CIB_REPLACE_NOTIFY)) { |
| 98 | do_send = TRUE; |
| 99 | |
| 100 | } else if (client->confirmations && safe_str_eq(type, T_CIB_UPDATE_CONFIRM)) { |
| 101 | do_send = TRUE; |
| 102 | |
| 103 | } else if (client->pre_notify && safe_str_eq(type, T_CIB_PRE_NOTIFY)) { |
| 104 | do_send = TRUE; |
| 105 | |
| 106 | } else if (client->post_notify && safe_str_eq(type, T_CIB_POST_NOTIFY)) { |
| 107 | do_send = TRUE; |
| 108 | } |
| 109 | |
| 110 | if (do_send) { |
| 111 | if (client->ipc) { |
| 112 | if(crm_ipcs_send(client->ipc, 0, update_msg, TRUE) == FALSE) { |
| 113 | crm_warn("Notification of client %s/%s failed", client->name, client->id); |
| 114 | } |
| 115 | |
| 116 | #ifdef HAVE_GNUTLS_GNUTLS_H |
| 117 | } else if (client->session) { |
| 118 | crm_debug("Sent %s notification to client %s/%s", type, client->name, client->id); |
| 119 | crm_send_remote_msg(client->session, update_msg, client->encrypted); |
| 120 | |
| 121 | #endif |
| 122 | } else { |
| 123 | crm_err("Unknown transport for %s", client->name); |
| 124 | } |
| 125 | } |
| 126 | return FALSE; |
| 127 | } |
| 128 | |
| 129 | void |
| 130 | cib_pre_notify(int options, const char *op, xmlNode * existing, xmlNode * update) |
nothing calls this directly
no test coverage detected