Usage of the SAForum AIS (Application Interface Specification). More...
#include <saAis.h>
#include <saClm.h>
#include <saEvt.h>
Go to the source code of this file.
Enumerations | |
enum | ast_ais_cmd { AST_AIS_CMD_EXIT, AST_AIS_CMD_MEMBERSHIP_CHANGED } |
Functions | |
const char * | ais_err2str (SaAisErrorT error) |
int | ast_ais_clm_load_module (void) |
int | ast_ais_clm_unload_module (void) |
int | ast_ais_cmd (enum ast_ais_cmd cmd) |
int | ast_ais_evt_load_module (void) |
void | ast_ais_evt_membership_changed (void) |
int | ast_ais_evt_unload_module (void) |
Variables | |
SaVersionT | ais_version |
SaClmHandleT | clm_handle |
SaEvtHandleT | evt_handle |
Usage of the SAForum AIS (Application Interface Specification).
Definition in file ais.h.
enum ast_ais_cmd |
Definition at line 50 of file ais.h.
00050 { 00051 AST_AIS_CMD_EXIT, 00052 AST_AIS_CMD_MEMBERSHIP_CHANGED, 00053 };
const char* ais_err2str | ( | SaAisErrorT | error | ) |
Definition at line 105 of file res_ais.c.
References ais_errors, ARRAY_LEN, and ais_error::desc.
Referenced by add_subscribe_event(), ast_ais_clm_load_module(), ast_ais_clm_unload_module(), ast_ais_evt_load_module(), ast_ais_evt_unload_module(), ast_event_cb(), build_event_channel(), event_channel_destroy(), evt_event_deliver_cb(), and subscribe_event_destroy().
00106 { 00107 int x; 00108 00109 for (x = 0; x < ARRAY_LEN(ais_errors); x++) { 00110 if (ais_errors[x].error == error) 00111 return ais_errors[x].desc; 00112 } 00113 00114 return "Unknown"; 00115 }
int ast_ais_clm_load_module | ( | void | ) |
Definition at line 157 of file clm.c.
References ais_err2str(), ais_version, ARRAY_LEN, ast_cli_register_multiple(), ast_log(), clm_callbacks, clm_handle, clm_init_res, and LOG_ERROR.
Referenced by load_module().
00158 { 00159 SaAisErrorT ais_res; 00160 00161 clm_init_res = saClmInitialize(&clm_handle, &clm_callbacks, &ais_version); 00162 if (clm_init_res != SA_AIS_OK) { 00163 ast_log(LOG_ERROR, "Could not initialize cluster membership service: %s\n", 00164 ais_err2str(clm_init_res)); 00165 return -1; 00166 } 00167 00168 ais_res = saClmClusterTrack(clm_handle, SA_TRACK_CHANGES, NULL); 00169 if (ais_res != SA_AIS_OK) { 00170 ast_log(LOG_ERROR, "Error starting tracking of cluster membership changes.\n"); 00171 } 00172 00173 ast_cli_register_multiple(ais_cli, ARRAY_LEN(ais_cli)); 00174 00175 return 0; 00176 }
int ast_ais_clm_unload_module | ( | void | ) |
Definition at line 178 of file clm.c.
References ais_err2str(), ARRAY_LEN, ast_cli_unregister_multiple(), ast_log(), clm_handle, clm_init_res, and LOG_ERROR.
Referenced by load_module(), and unload_module().
00179 { 00180 SaAisErrorT ais_res; 00181 00182 if (clm_init_res != SA_AIS_OK) { 00183 return 0; 00184 } 00185 00186 ast_cli_unregister_multiple(ais_cli, ARRAY_LEN(ais_cli)); 00187 00188 ais_res = saClmFinalize(clm_handle); 00189 if (ais_res != SA_AIS_OK) { 00190 ast_log(LOG_ERROR, "Problem stopping cluster membership service: %s\n", 00191 ais_err2str(ais_res)); 00192 return -1; 00193 } 00194 00195 return 0; 00196 }
int ast_ais_cmd | ( | enum ast_ais_cmd | cmd | ) |
Definition at line 182 of file res_ais.c.
References ast_debug, and dispatch_thread.
00183 { 00184 int res; 00185 00186 res = write(dispatch_thread.alert_pipe[1], (char *) &cmd, sizeof(cmd)); 00187 00188 ast_debug(1, "AIS cmd: %d, res: %d\n", cmd, res); 00189 00190 return res; 00191 }
int ast_ais_evt_load_module | ( | void | ) |
Definition at line 576 of file evt.c.
References ais_err2str(), ais_version, ARRAY_LEN, ast_cli_register_multiple(), ast_log(), evt_callbacks, evt_handle, evt_init_res, load_config(), and LOG_ERROR.
Referenced by load_module().
00577 { 00578 evt_init_res = saEvtInitialize(&evt_handle, &evt_callbacks, &ais_version); 00579 if (evt_init_res != SA_AIS_OK) { 00580 ast_log(LOG_ERROR, "Could not initialize eventing service: %s\n", 00581 ais_err2str(evt_init_res)); 00582 return -1; 00583 } 00584 00585 load_config(); 00586 00587 ast_cli_register_multiple(ais_cli, ARRAY_LEN(ais_cli)); 00588 00589 return 0; 00590 }
void ast_ais_evt_membership_changed | ( | void | ) |
Definition at line 319 of file evt.c.
References ast_debug, ast_event_dump_cache(), AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, event_channel::name, event_channel::publish_events, and publish_event::sub.
Referenced by dispatch_thread_handler().
00320 { 00321 struct event_channel *ec; 00322 00323 AST_RWLIST_RDLOCK(&event_channels); 00324 AST_RWLIST_TRAVERSE(&event_channels, ec, entry) { 00325 struct publish_event *pe; 00326 00327 AST_LIST_TRAVERSE(&ec->publish_events, pe, entry) { 00328 ast_debug(1, "Dumping cache for event channel '%s'\n", ec->name); 00329 ast_event_dump_cache(pe->sub); 00330 } 00331 } 00332 AST_RWLIST_UNLOCK(&event_channels); 00333 }
int ast_ais_evt_unload_module | ( | void | ) |
Definition at line 592 of file evt.c.
References ais_err2str(), ast_log(), destroy_event_channels(), evt_handle, evt_init_res, and LOG_ERROR.
Referenced by load_module(), and unload_module().
00593 { 00594 SaAisErrorT ais_res; 00595 00596 if (evt_init_res != SA_AIS_OK) { 00597 return 0; 00598 } 00599 00600 destroy_event_channels(); 00601 00602 ais_res = saEvtFinalize(evt_handle); 00603 if (ais_res != SA_AIS_OK) { 00604 ast_log(LOG_ERROR, "Problem stopping eventing service: %s\n", 00605 ais_err2str(ais_res)); 00606 return -1; 00607 } 00608 00609 return 0; 00610 }
SaVersionT ais_version |
Definition at line 70 of file res_ais.c.
Referenced by ast_ais_clm_load_module(), and ast_ais_evt_load_module().
SaClmHandleT clm_handle |
Definition at line 52 of file clm.c.
Referenced by ais_clm_show_members(), ast_ais_clm_load_module(), ast_ais_clm_unload_module(), ast_event_cb(), and dispatch_thread_handler().
SaEvtHandleT evt_handle |
Definition at line 61 of file evt.c.
Referenced by ast_ais_evt_load_module(), ast_ais_evt_unload_module(), build_event_channel(), and dispatch_thread_handler().