static void cpg_confchg_cb(cpg_handle_t handle, const struct cpg_name *group_name, const struct cpg_address *member_list, size_t member_list_entries, const struct cpg_address *left_list, size_t left_list_entries, const struct cpg_address *joined_list, size_t joined_list_entries) { unsigned int i; /* If any new nodes have joined, dump our cache of events we are publishing * that originated from this server. */ if (!joined_list_entries) { return; } for (i = 0; i < ARRAY_LEN(event_types); i++) { struct ast_event_sub *event_sub; ast_rwlock_rdlock(&event_types_lock); if (!event_types[i].publish) { ast_rwlock_unlock(&event_types_lock); continue; } ast_rwlock_unlock(&event_types_lock); event_sub = ast_event_subscribe_new(i, ast_event_cb, NULL); ast_event_sub_append_ie_raw(event_sub, AST_EVENT_IE_EID, &ast_eid_default, sizeof(ast_eid_default)); ast_event_dump_cache(event_sub); ast_event_sub_destroy(event_sub); } }
static char *handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { unsigned int i; struct ast_event_sub *sub; switch (cmd) { case CLI_INIT: e->command = "cel show status"; e->usage = "Usage: cel show status\n" " Displays the Channel Event Logging system status.\n"; return NULL; case CLI_GENERATE: return NULL; case CLI_HANDLER: break; } if (a->argc > 3) { return CLI_SHOWUSAGE; } ast_cli(a->fd, "CEL Logging: %s\n", cel_enabled ? "Enabled" : "Disabled"); if (!cel_enabled) { return CLI_SUCCESS; } for (i = 0; i < (sizeof(eventset) * 8); i++) { const char *name; if (!(eventset & ((int64_t) 1 << i))) { continue; } name = ast_cel_get_type_name(i); if (strcasecmp(name, "Unknown")) { ast_cli(a->fd, "CEL Tracking Event: %s\n", name); } } ao2_callback(appset, OBJ_NODATA, print_app, a); if (!(sub = ast_event_subscribe_new(AST_EVENT_SUB, print_cel_sub, a))) { return CLI_FAILURE; } ast_event_sub_append_ie_uint(sub, AST_EVENT_IE_EVENTTYPE, AST_EVENT_CEL); ast_event_report_subs(sub); ast_event_sub_destroy(sub); sub = NULL; return CLI_SUCCESS; }