mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-08-05 17:52:03 +00:00
enhancement 1049
enhance services so dynamic service handlers are more easily possible git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@905 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
parent
8f4588464b
commit
2753438b4a
301
exec/amf.c
301
exec/amf.c
@ -127,71 +127,66 @@ static char *operationalstate_ntoa (OpenaisCfgOperationalStateT state);
|
||||
static char *hastate_ntoa (SaAmfHAStateT state);
|
||||
static char *readinessstate_ntoa (int state);
|
||||
|
||||
static int amf_confchg_fn (
|
||||
static void amf_confchg_fn (
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
struct totem_ip_address *joined_list, int joined_list_entries,
|
||||
struct memb_ring_id *ring_id);
|
||||
|
||||
static int amf_exit_fn (struct conn_info *conn_info);
|
||||
static int amf_lib_exit_fn (struct conn_info *conn_info);
|
||||
|
||||
static int amf_exec_init_fn (struct openais_config *);
|
||||
|
||||
static int amf_init_two_fn (struct conn_info *conn_info);
|
||||
static int amf_lib_init_fn (struct conn_info *conn_info);
|
||||
|
||||
static int message_handler_req_lib_amf_componentregister (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_componentregister (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_componentunregister (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_componentunregister (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_pmstart (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_pmstart (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_pmstop (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_pmstop (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_healthcheckstart (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_healthcheckstart (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_healthcheckconfirm (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_healthcheckconfirm (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_healthcheckstop (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_healthcheckstop (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_hastateget (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_hastateget (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_csiquiescingcomplete (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_csiquiescingcomplete (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_protectiongrouptrackstart (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_protectiongrouptrackstart (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_protectiongrouptrackstop (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_protectiongrouptrackstop (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_componenterrorreport (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_componenterrorreport (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_componenterrorclear (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_componenterrorclear (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_amf_response (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_amf_response (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_exec_amf_operational_state_comp_set (
|
||||
static void message_handler_req_exec_amf_operational_state_comp_set (
|
||||
void *message,
|
||||
struct totem_ip_address *source,
|
||||
int endian_conversion_required);
|
||||
struct totem_ip_address *source);
|
||||
|
||||
static int message_handler_req_exec_amf_presence_state_comp_set (
|
||||
static void message_handler_req_exec_amf_presence_state_comp_set (
|
||||
void *message,
|
||||
struct totem_ip_address *source,
|
||||
int endian_conversion_required);
|
||||
struct totem_ip_address *source);
|
||||
|
||||
static int message_handler_req_exec_amf_administrative_state_csi_set (
|
||||
static void message_handler_req_exec_amf_administrative_state_csi_set (
|
||||
void *message,
|
||||
struct totem_ip_address *source,
|
||||
int endian_conversion_required);
|
||||
struct totem_ip_address *source);
|
||||
|
||||
static int message_handler_req_exec_amf_administrative_state_unit_set (
|
||||
static void message_handler_req_exec_amf_administrative_state_unit_set (
|
||||
void *message,
|
||||
struct totem_ip_address *source,
|
||||
int endian_conversion_required);
|
||||
struct totem_ip_address *source);
|
||||
|
||||
static int message_handler_req_exec_amf_administrative_state_group_set (
|
||||
static void message_handler_req_exec_amf_administrative_state_group_set (
|
||||
void *message,
|
||||
struct totem_ip_address *source,
|
||||
int endian_conversion_required);
|
||||
struct totem_ip_address *source);
|
||||
|
||||
void presence_state_comp_set (
|
||||
struct amf_comp *comp,
|
||||
@ -266,129 +261,136 @@ struct clc_interface *clc_interfaces[4] = {
|
||||
/*
|
||||
* Service Handler Definition
|
||||
*/
|
||||
struct libais_handler amf_libais_handlers[] =
|
||||
static struct openais_lib_handler amf_lib_handlers[] =
|
||||
{
|
||||
{ /* 0 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_componentregister,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_componentregister,
|
||||
.response_size = sizeof (struct res_lib_amf_componentregister),
|
||||
.response_id = MESSAGE_RES_AMF_COMPONENTREGISTER,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 1 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_componentunregister,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_componentunregister,
|
||||
.response_size = sizeof (struct res_lib_amf_componentunregister),
|
||||
.response_id = MESSAGE_RES_AMF_COMPONENTUNREGISTER,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 2 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_pmstart,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_pmstart,
|
||||
.response_size = sizeof (struct res_lib_amf_pmstart),
|
||||
.response_id = MESSAGE_RES_AMF_PMSTART,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 3 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_pmstop,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_pmstop,
|
||||
.response_size = sizeof (struct res_lib_amf_pmstop),
|
||||
.response_id = MESSAGE_RES_AMF_PMSTOP,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 4 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_healthcheckstart,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_healthcheckstart,
|
||||
.response_size = sizeof (struct res_lib_amf_healthcheckstart),
|
||||
.response_id = MESSAGE_RES_AMF_HEALTHCHECKSTART,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 5 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_healthcheckconfirm,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_healthcheckconfirm,
|
||||
.response_size = sizeof (struct res_lib_amf_healthcheckconfirm),
|
||||
.response_id = MESSAGE_RES_AMF_HEALTHCHECKCONFIRM,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 6 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_healthcheckstop,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_healthcheckstop,
|
||||
.response_size = sizeof (struct res_lib_amf_healthcheckstop),
|
||||
.response_id = MESSAGE_RES_AMF_HEALTHCHECKSTOP,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 7 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_hastateget,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_hastateget,
|
||||
.response_size = sizeof (struct res_lib_amf_hastateget),
|
||||
.response_id = MESSAGE_RES_AMF_HASTATEGET,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 8 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_csiquiescingcomplete,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_csiquiescingcomplete,
|
||||
.response_size = sizeof (struct res_lib_amf_csiquiescingcomplete),
|
||||
.response_id = MESSAGE_RES_AMF_CSIQUIESCINGCOMPLETE,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 9 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_protectiongrouptrackstart,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_protectiongrouptrackstart,
|
||||
.response_size = sizeof (struct res_lib_amf_protectiongrouptrackstart),
|
||||
.response_id = MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTART,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 10 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_protectiongrouptrackstop,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_protectiongrouptrackstop,
|
||||
.response_size = sizeof (struct res_lib_amf_protectiongrouptrackstop),
|
||||
.response_id = MESSAGE_RES_AMF_PROTECTIONGROUPTRACKSTOP,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 11 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_componenterrorreport,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_componenterrorreport,
|
||||
.response_size = sizeof (struct res_lib_amf_componenterrorreport),
|
||||
.response_id = MESSAGE_RES_AMF_COMPONENTERRORREPORT,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 12 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_componenterrorclear,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_componenterrorclear,
|
||||
.response_size = sizeof (struct res_lib_amf_componenterrorclear),
|
||||
.response_id = MESSAGE_RES_AMF_COMPONENTERRORCLEAR,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 13 */
|
||||
.libais_handler_fn = message_handler_req_lib_amf_response,
|
||||
.lib_handler_fn = message_handler_req_lib_amf_response,
|
||||
.response_size = sizeof (struct res_lib_amf_response),
|
||||
.response_id = MESSAGE_RES_AMF_RESPONSE, // TODO
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
};
|
||||
|
||||
int (*amf_aisexec_handler_fns[]) (
|
||||
void *,
|
||||
struct totem_ip_address *source,
|
||||
int endian_conversion_required) =
|
||||
{
|
||||
message_handler_req_exec_amf_operational_state_comp_set,
|
||||
message_handler_req_exec_amf_presence_state_comp_set,
|
||||
message_handler_req_exec_amf_administrative_state_csi_set,
|
||||
message_handler_req_exec_amf_administrative_state_unit_set,
|
||||
message_handler_req_exec_amf_administrative_state_group_set
|
||||
static struct openais_exec_handler amf_exec_handlers[] = {
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_amf_operational_state_comp_set,
|
||||
},
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_amf_presence_state_comp_set,
|
||||
},
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_amf_administrative_state_csi_set,
|
||||
},
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_amf_administrative_state_unit_set,
|
||||
},
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_amf_administrative_state_group_set
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Exports the interface for the service
|
||||
*/
|
||||
struct service_handler amf_service_handler = {
|
||||
.name = "openais availability management framework B.01.01",
|
||||
struct openais_service_handler amf_service_handler = {
|
||||
.name = (unsigned char *)"openais availability management framework B.01.01",
|
||||
.id = AMF_SERVICE,
|
||||
.libais_handlers = amf_libais_handlers,
|
||||
.libais_handlers_count = sizeof (amf_libais_handlers) / sizeof (struct libais_handler),
|
||||
.aisexec_handler_fns = amf_aisexec_handler_fns,
|
||||
.aisexec_handler_fns_count = sizeof (amf_aisexec_handler_fns) / sizeof (int (*)),
|
||||
.confchg_fn = amf_confchg_fn,
|
||||
.libais_init_two_fn = amf_init_two_fn,
|
||||
.libais_exit_fn = amf_exit_fn,
|
||||
.lib_init_fn = amf_lib_init_fn,
|
||||
.lib_exit_fn = amf_lib_exit_fn,
|
||||
.lib_handlers = amf_lib_handlers,
|
||||
.lib_handlers_count = sizeof (amf_lib_handlers) / sizeof (struct openais_lib_handler),
|
||||
.exec_init_fn = amf_exec_init_fn,
|
||||
.exec_handlers = amf_exec_handlers,
|
||||
.exec_handlers_count = sizeof (amf_exec_handlers) / sizeof (struct openais_exec_handler),
|
||||
.confchg_fn = amf_confchg_fn,
|
||||
};
|
||||
|
||||
#ifdef BUILD_DYNAMIC
|
||||
|
||||
struct service_handler *amf_get_handler_ver0 (void);
|
||||
struct openais_service_handler *amf_get_handler_ver0 (void);
|
||||
|
||||
struct aisexec_iface_ver0 amf_service_handler_iface = {
|
||||
struct openais_service_handler_iface_ver0 amf_service_handler_iface = {
|
||||
.test = NULL,
|
||||
.get_handler_ver0 = amf_get_handler_ver0
|
||||
.openais_get_service_handler_ver0 = amf_get_handler_ver0
|
||||
};
|
||||
|
||||
struct lcr_iface openais_amf_ver0[1] = {
|
||||
@ -416,7 +418,7 @@ extern int lcr_comp_get (struct lcr_comp **component)
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct service_handler *amf_get_handler_ver0 (void)
|
||||
struct openais_service_handler *amf_get_handler_ver0 (void)
|
||||
{
|
||||
return (&amf_service_handler);
|
||||
}
|
||||
@ -726,8 +728,8 @@ printf ("component presence state %d\n", comp->presence_state);
|
||||
invocation_create (
|
||||
AMF_RESPONSE_COMPONENTTERMINATECALLBACK,
|
||||
component_terminate_callback_data);
|
||||
printf ("Creating invocation %lld",
|
||||
res_lib_amf_componentterminatecallback.invocation);
|
||||
printf ("Creating invocation %llu",
|
||||
(unsigned long long)res_lib_amf_componentterminatecallback.invocation);
|
||||
|
||||
libais_send_response (
|
||||
comp->conn_info->conn_info_partner,
|
||||
@ -836,7 +838,7 @@ static int amf_exec_init_fn (struct openais_config *openais_config)
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
static int amf_confchg_fn (
|
||||
static void amf_confchg_fn (
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
@ -873,10 +875,9 @@ static int amf_confchg_fn (
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
int amf_exit_fn (struct conn_info *conn_info)
|
||||
int amf_lib_exit_fn (struct conn_info *conn_info)
|
||||
{
|
||||
struct amf_comp *comp;
|
||||
|
||||
@ -899,7 +900,7 @@ printf ("setting in exit fn to uninst for comp %p\n", comp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int amf_init_two_fn (struct conn_info *conn_info)
|
||||
static int amf_lib_init_fn (struct conn_info *conn_info)
|
||||
{
|
||||
log_printf (LOG_LEVEL_DEBUG, "Got request to initalize availability management framework service.\n");
|
||||
|
||||
@ -1343,8 +1344,9 @@ void operational_state_comp_set (struct amf_comp *comp, OpenaisCfgOperationalSta
|
||||
struct iovec iovec;
|
||||
|
||||
req_exec_amf_operational_state_comp_set.header.size = sizeof (struct req_exec_amf_operational_state_comp_set);
|
||||
req_exec_amf_operational_state_comp_set.header.id = MESSAGE_REQ_EXEC_AMF_OPERATIONAL_STATE_COMP_SET;
|
||||
req_exec_amf_operational_state_comp_set.header.id =
|
||||
SERVICE_ID_MAKE (AMF_SERVICE, MESSAGE_REQ_EXEC_AMF_OPERATIONAL_STATE_COMP_SET);
|
||||
|
||||
req_exec_amf_operational_state_comp_set.operational_state = operational_state;
|
||||
memcpy (&req_exec_amf_operational_state_comp_set.name,
|
||||
&comp->name,
|
||||
@ -1502,7 +1504,7 @@ int clc_instantiate_all (void) {
|
||||
comp = list_entry (list_comp,
|
||||
struct amf_comp, comp_list);
|
||||
|
||||
if (strlen (comp->instantiate_cmd)) {
|
||||
if (strlen ((char *)comp->instantiate_cmd)) {
|
||||
|
||||
clc_instantiate (comp);
|
||||
}
|
||||
@ -1681,8 +1683,8 @@ void csi_unit_create (struct amf_unit *unit, struct amf_si *si,
|
||||
csi->unit = unit;
|
||||
csi->pg_set = 0;
|
||||
|
||||
sprintf (csi->name.value, "CSI %d", csi_number);
|
||||
csi->name.length = strlen (csi->name.value);
|
||||
sprintf ((char *)csi->name.value, "CSI %d", csi_number);
|
||||
csi->name.length = strlen ((char *)csi->name.value);
|
||||
|
||||
csi_number += 1;
|
||||
*csi_out = csi;
|
||||
@ -2244,10 +2246,9 @@ void operational_state_unit_set (
|
||||
}
|
||||
|
||||
|
||||
static int message_handler_req_exec_amf_operational_state_comp_set (
|
||||
static void message_handler_req_exec_amf_operational_state_comp_set (
|
||||
void *message,
|
||||
struct totem_ip_address *address,
|
||||
int endian_conversion_required)
|
||||
struct totem_ip_address *address)
|
||||
{
|
||||
struct req_exec_amf_operational_state_comp_set *req_exec_amf_operational_state_comp_set =
|
||||
(struct req_exec_amf_operational_state_comp_set *)message;
|
||||
@ -2284,13 +2285,11 @@ static int message_handler_req_exec_amf_operational_state_comp_set (
|
||||
OPENAIS_CFG_OPERATIONALSTATE_DISABLED);
|
||||
}
|
||||
readiness_state_comp_set (comp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_amf_presence_state_comp_set (
|
||||
static void message_handler_req_exec_amf_presence_state_comp_set (
|
||||
void *message,
|
||||
struct totem_ip_address *address,
|
||||
int endian_conversion_required)
|
||||
struct totem_ip_address *address)
|
||||
{
|
||||
struct req_exec_amf_presence_state_comp_set *req_exec_amf_presence_state_comp_set =
|
||||
(struct req_exec_amf_presence_state_comp_set *)message;
|
||||
@ -2302,7 +2301,7 @@ static int message_handler_req_exec_amf_presence_state_comp_set (
|
||||
comp = find_comp (&req_exec_amf_presence_state_comp_set->name);
|
||||
if (req_exec_amf_presence_state_comp_set->presence_state == comp->presence_state) {
|
||||
printf ("duplicate presence state set, not setting presence state\n");
|
||||
return (0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (req_exec_amf_presence_state_comp_set->presence_state == OPENAIS_CFG_PRESENCESTATE_UNINSTANTIATED) {
|
||||
@ -2316,7 +2315,7 @@ static int message_handler_req_exec_amf_presence_state_comp_set (
|
||||
comp->presence_state != OPENAIS_CFG_PRESENCESTATE_UNINSTANTIATED) {
|
||||
|
||||
printf ("restart presence state set even though not in terminating state\n");
|
||||
return (0);
|
||||
return;
|
||||
}
|
||||
|
||||
comp->presence_state = req_exec_amf_presence_state_comp_set->presence_state;
|
||||
@ -2352,45 +2351,38 @@ printf ("restart presence state set even though not in terminating state\n");
|
||||
presence_state_unit_set (comp->unit,
|
||||
OPENAIS_CFG_PRESENCESTATE_INSTANTIATED);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_amf_administrative_state_csi_set (
|
||||
static void message_handler_req_exec_amf_administrative_state_csi_set (
|
||||
void *message,
|
||||
struct totem_ip_address *address,
|
||||
int endian_conversion_required)
|
||||
struct totem_ip_address *address)
|
||||
{
|
||||
// struct req_exec_amf_administrative_state_csi_set *req_exec_amf_administrative_state_csi_set =
|
||||
// (struct req_exec_amf_administrative_state_csi_set *)message;
|
||||
// TODO
|
||||
return (0);
|
||||
}
|
||||
static int message_handler_req_exec_amf_administrative_state_unit_set (
|
||||
static void message_handler_req_exec_amf_administrative_state_unit_set (
|
||||
void *message,
|
||||
struct totem_ip_address *address,
|
||||
int endian_conversion_required)
|
||||
struct totem_ip_address *address)
|
||||
{
|
||||
// struct req_exec_amf_administrative_state_unit_set *req_exec_amf_administrative_state_unit_set =
|
||||
// (struct req_exec_amf_administrative_state_unit_set *)message;
|
||||
// TODO
|
||||
return (0);
|
||||
}
|
||||
static int message_handler_req_exec_amf_administrative_state_group_set (
|
||||
static void message_handler_req_exec_amf_administrative_state_group_set (
|
||||
void *message,
|
||||
struct totem_ip_address *source,
|
||||
int endian_conversion_required)
|
||||
struct totem_ip_address *source)
|
||||
{
|
||||
// struct req_exec_amf_administrative_state_group_set *req_exec_amf_administrative_state_group_set =
|
||||
// (struct req_exec_amf_administrative_state_group_set *)message;
|
||||
// TODO
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Library Interface Implementation
|
||||
*/
|
||||
static int message_handler_req_lib_amf_componentregister (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_componentregister (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_amf_componentregister *req_lib_amf_componentregister =
|
||||
(struct req_lib_amf_componentregister *)message;
|
||||
@ -2415,10 +2407,9 @@ static int message_handler_req_lib_amf_componentregister (struct conn_info *conn
|
||||
res_lib_amf_componentregister.header.error = error;
|
||||
libais_send_response (conn_info, &res_lib_amf_componentregister,
|
||||
sizeof (struct res_lib_amf_componentregister));
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_componentunregister (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_componentunregister (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
#ifdef COMPILE_OUT
|
||||
struct req_lib_amf_componentunregister *req_lib_amf_componentunregister = (struct req_lib_amf_componentunregister *)message;
|
||||
@ -2448,19 +2439,16 @@ static int message_handler_req_lib_amf_componentunregister (struct conn_info *co
|
||||
assert (totempg_groups_mcast_joined (openais_group_handle,
|
||||
&iovec, 1, TOTEMPG_AGREED) == 0);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_pmstart (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_pmstart (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
static int message_handler_req_lib_amf_pmstop (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_pmstop (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_healthcheckstart (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_healthcheckstart (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_amf_healthcheckstart *req_lib_amf_healthcheckstart =
|
||||
(struct req_lib_amf_healthcheckstart *)message;
|
||||
@ -2539,15 +2527,13 @@ error_exit:
|
||||
|
||||
libais_send_response (conn_info, &res_lib_amf_healthcheckstart,
|
||||
sizeof (struct res_lib_amf_healthcheckstart));
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_healthcheckconfirm (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_healthcheckconfirm (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_healthcheckstop (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_healthcheckstop (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_amf_healthcheckstop *req_lib_amf_healthcheckstop =
|
||||
(struct req_lib_amf_healthcheckstop *)message;
|
||||
@ -2584,10 +2570,9 @@ error_exit:
|
||||
|
||||
libais_send_response (conn_info, &res_lib_amf_healthcheckstop,
|
||||
sizeof (struct res_lib_amf_healthcheckstop));
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_hastateget (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_hastateget (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
#ifdef COMPILE_OUT
|
||||
struct req_lib_amf_hastateget *req_lib_amf_hastateget = (struct req_lib_amf_hastateget *)message;
|
||||
@ -2611,10 +2596,9 @@ static int message_handler_req_lib_amf_hastateget (struct conn_info *conn_info,
|
||||
}
|
||||
libais_send_response (conn_info, &res_lib_amf_hastateget, sizeof (struct res_lib_amf_hastateget));
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_protectiongrouptrackstart (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_protectiongrouptrackstart (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
#ifdef COMPILE_OUT
|
||||
struct req_lib_amf_protectiongrouptrackstart *req_lib_amf_protectiongrouptrackstart = (struct req_lib_amf_protectiongrouptrackstart *)message;
|
||||
@ -2680,15 +2664,13 @@ static int message_handler_req_lib_amf_protectiongrouptrackstart (struct conn_in
|
||||
track->trackFlags &= ~SA_TRACK_CURRENT;
|
||||
}
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_csiquiescingcomplete (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_csiquiescingcomplete (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_protectiongrouptrackstop (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_protectiongrouptrackstop (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
#ifdef COMPILE_OUT
|
||||
struct req_lib_amf_protectiongrouptrackstop *req_lib_amf_protectiongrouptrackstop = (struct req_lib_amf_protectiongrouptrackstop *)message;
|
||||
@ -2726,10 +2708,9 @@ static int message_handler_req_lib_amf_protectiongrouptrackstop (struct conn_inf
|
||||
sizeof (struct res_lib_amf_protectiongrouptrackstop));
|
||||
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_componenterrorreport (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_componenterrorreport (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_amf_componenterrorreport *req_lib_amf_componenterrorreport = (struct req_lib_amf_componenterrorreport *)message;
|
||||
struct res_lib_amf_componenterrorreport res_lib_amf_componenterrorreport;
|
||||
@ -2755,10 +2736,9 @@ printf ("escalation policy terminate\n");
|
||||
&res_lib_amf_componenterrorreport,
|
||||
sizeof (struct res_lib_amf_componenterrorreport));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_componenterrorclear (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_componenterrorclear (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
#ifdef COMPILLE_OUT
|
||||
struct req_lib_amf_componenterrorclear *req_lib_amf_componenterrorclear = (struct req_lib_amf_componenterrorclear *)message;
|
||||
@ -2785,7 +2765,6 @@ static int message_handler_req_lib_amf_componenterrorclear (struct conn_info *co
|
||||
&iovec, 1, TOTEMPG_AGREED) == 0);
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void pg_comp_create (
|
||||
@ -2804,7 +2783,7 @@ void pg_comp_create (
|
||||
list_add_tail (&pg_comp->list, &pg->pg_comp_head);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_response (struct conn_info *conn_info_nouse, void *message)
|
||||
static void message_handler_req_lib_amf_response (struct conn_info *conn_info_nouse, void *message)
|
||||
{
|
||||
struct req_lib_amf_response *req_lib_amf_response = (struct req_lib_amf_response *)message;
|
||||
struct res_lib_amf_response res_lib_amf_response;
|
||||
@ -2896,7 +2875,6 @@ error_exit:
|
||||
&res_lib_amf_response,
|
||||
sizeof (struct res_lib_amf_response));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@ -2904,7 +2882,7 @@ error_exit:
|
||||
/*
|
||||
* Executive Message Implementation
|
||||
*/
|
||||
static int message_handler_req_exec_amf_componentregister (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
static void message_handler_req_exec_amf_componentregister (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
{
|
||||
#ifdef COMPILE_OUT
|
||||
struct req_exec_amf_componentregister *req_exec_amf_componentregister = (struct req_exec_amf_componentregister *)message;
|
||||
@ -2928,7 +2906,7 @@ static int message_handler_req_exec_amf_componentregister (void *message, struct
|
||||
*/
|
||||
if (req_exec_amf_componentregister->source.in_addr.s_addr == 0) {
|
||||
amf_synchronize (message, source_addr);
|
||||
return (0);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3010,10 +2988,9 @@ static int message_handler_req_exec_amf_componentregister (void *message, struct
|
||||
}
|
||||
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_amf_componentunregister (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
static void message_handler_req_exec_amf_componentunregister (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
{
|
||||
struct req_exec_amf_componentunregister *req_exec_amf_componentunregister = (struct req_exec_amf_componentunregister *)message;
|
||||
struct res_lib_amf_componentunregister res_lib_amf_componentunregister;
|
||||
@ -3078,10 +3055,10 @@ static int message_handler_req_exec_amf_componentunregister (void *message, stru
|
||||
&res_lib_amf_componentunregister, sizeof (struct res_lib_amf_componentunregister));
|
||||
}
|
||||
|
||||
return (0);
|
||||
return;
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_amf_componenterrorreport (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
static void message_handler_req_exec_amf_componenterrorreport (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
{
|
||||
struct req_exec_amf_componenterrorreport *req_exec_amf_componenterrorreport = (struct req_exec_amf_componenterrorreport *)message;
|
||||
struct res_lib_amf_componenterrorreport res_lib_amf_componenterrorreport;
|
||||
@ -3117,7 +3094,7 @@ static int message_handler_req_exec_amf_componenterrorreport (void *message, str
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_amf_componenterrorclear (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
static void message_handler_req_exec_amf_componenterrorclear (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
{
|
||||
struct req_exec_amf_componenterrorclear *req_exec_amf_componenterrorclear = (struct req_exec_amf_componenterrorclear *)message;
|
||||
struct res_lib_amf_componenterrorclear res_lib_amf_componenterrorclear;
|
||||
@ -4255,7 +4232,7 @@ void amf_confchg_nleave (struct amf_comp *component ,void *data)
|
||||
* node. That cluster node API has verified the readiness state, so its time to let
|
||||
* the rest of the cluster nodes know about the readiness state change.
|
||||
*/
|
||||
static int message_handler_req_exec_amf_readinessstateset (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
static void message_handler_req_exec_amf_readinessstateset (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
{
|
||||
struct req_exec_amf_readinessstateset *req_exec_amf_readinessstateset = (struct req_exec_amf_readinessstateset *)message;
|
||||
struct amf_comp *component;
|
||||
@ -4280,7 +4257,7 @@ static int message_handler_req_exec_amf_readinessstateset (void *message, struct
|
||||
* node. That cluster node API has verified the ha state, so its time to let
|
||||
* the rest of the cluster nodes know about the HA state change.
|
||||
*/
|
||||
static int message_handler_req_exec_amf_hastateset (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
static void message_handler_req_exec_amf_hastateset (void *message, struct in_addr source_addr, int endian_conversion_required)
|
||||
{
|
||||
struct req_exec_amf_hastateset *req_exec_amf_hastateset = (struct req_exec_amf_hastateset *)message;
|
||||
struct amf_comp *component;
|
||||
@ -4319,7 +4296,7 @@ static int message_handler_req_exec_amf_hastateset (void *message, struct in_add
|
||||
|
||||
|
||||
|
||||
static int message_handler_req_lib_amf_readinessstateget (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_readinessstateget (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
<<<<<<< .mine
|
||||
struct req_lib_amf_readinessstateget *req_lib_amf_readinessstateget = (struct req_lib_amf_readinessstateget *)message;
|
||||
@ -4347,7 +4324,7 @@ static int message_handler_req_lib_amf_readinessstateget (struct conn_info *conn
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_amf_componentunregister (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_amf_componentunregister (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_amf_componentunregister *req_lib_amf_componentunregister = (struct req_lib_amf_componentunregister *)message;
|
||||
struct req_exec_amf_componentunregister req_exec_amf_componentunregister;
|
||||
@ -4376,7 +4353,7 @@ static int message_handler_req_amf_componentunregister (struct conn_info *conn_i
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_amf_readinessstateget (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_amf_readinessstateget (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_amf_readinessstateget *req_amf_readinessstateget = (struct req_amf_readinessstateget *)message;
|
||||
>>>>>>> .r872
|
||||
@ -4401,7 +4378,7 @@ static int message_handler_req_amf_readinessstateget (struct conn_info *conn_inf
|
||||
}
|
||||
|
||||
|
||||
static int message_handler_req_lib_amf_stoppingcomplete (struct conn_info *conn_info_notused,
|
||||
static void message_handler_req_lib_amf_stoppingcomplete (struct conn_info *conn_info_notused,
|
||||
void *message)
|
||||
{
|
||||
struct req_lib_amf_stoppingcomplete *req_lib_amf_stoppingcomplete = (struct req_lib_amf_stoppingcomplete *)message;
|
||||
@ -4468,7 +4445,7 @@ static int message_handler_req_lib_amf_stoppingcomplete (struct conn_info *conn_
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_amf_protectiongrouptrackstop (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_amf_protectiongrouptrackstop (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_amf_protectiongrouptrackstop *req_amf_protectiongrouptrackstop = (struct req_amf_protectiongrouptrackstop *)message;
|
||||
struct res_lib_amf_protectiongrouptrackstop res_lib_amf_protectiongrouptrackstop;
|
||||
@ -4507,7 +4484,7 @@ static int message_handler_req_amf_protectiongrouptrackstop (struct conn_info *c
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_amf_errorreport (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_amf_errorreport (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_amf_errorreport *req_lib_amf_errorreport = (struct req_lib_amf_errorreport *)message;
|
||||
struct req_exec_amf_errorreport req_exec_amf_errorreport;
|
||||
@ -4533,7 +4510,7 @@ static int message_handler_req_amf_errorreport (struct conn_info *conn_info, voi
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_amf_errorcancelall (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_amf_errorcancelall (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_amf_errorcancelall *req_lib_amf_errorcancelall = (struct req_lib_amf_errorcancelall *)message;
|
||||
struct req_exec_amf_errorcancelall req_exec_amf_errorcancelall;
|
||||
@ -4559,7 +4536,7 @@ static int message_handler_req_amf_errorcancelall (struct conn_info *conn_info,
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_amf_stoppingcomplete (struct conn_info *conn_info_notused,
|
||||
static void message_handler_req_amf_stoppingcomplete (struct conn_info *conn_info_notused,
|
||||
void *message)
|
||||
{
|
||||
struct req_amf_stoppingcomplete *req_amf_stoppingcomplete = (struct req_amf_stoppingcomplete *)message;
|
||||
@ -4590,7 +4567,7 @@ void response_handler_healthcheckcallback (struct conn_info *conn_info,
|
||||
}
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_amf_componentcapabilitymodelget (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_amf_componentcapabilitymodelget (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_amf_componentcapabilitymodelget *req_lib_amf_componentcapabilitymodelget = (struct req_lib_amf_componentcapabilitymodelget *)message;
|
||||
struct res_lib_amf_componentcapabilitymodelget res_lib_amf_componentcapabilitymodelget;
|
||||
|
@ -58,6 +58,6 @@ struct libamf_ci {
|
||||
};
|
||||
|
||||
void amf_dump ();
|
||||
extern struct service_handler amf_service_handler;
|
||||
extern struct openais_service_handler amf_service_handler;
|
||||
|
||||
#endif /* AMF_H_DEFINED */
|
||||
|
122
exec/cfg.c
122
exec/cfg.c
@ -64,59 +64,62 @@
|
||||
#define LOG_LEVEL_FROM_GMI LOG_LEVEL_DEBUG
|
||||
#define LOG_LEVEL_ENTER_FUNC LOG_LEVEL_DEBUG
|
||||
|
||||
static int cfg_confchg_fn (
|
||||
static void cfg_confchg_fn (
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct in_addr *member_list, int member_list_entries,
|
||||
struct in_addr *left_list, int left_list_entries,
|
||||
struct in_addr *joined_list, int joined_list_entries,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
struct totem_ip_address *joined_list, int joined_list_entries,
|
||||
struct memb_ring_id *ring_id);
|
||||
|
||||
static int cfg_exit_fn (struct conn_info *conn_info);
|
||||
static int cfg_lib_exit_fn (struct conn_info *conn_info);
|
||||
|
||||
static int cfg_exec_init_fn (struct openais_config *);
|
||||
|
||||
static int cfg_init_two_fn (struct conn_info *conn_info);
|
||||
static int cfg_lib_init_fn (struct conn_info *conn_info);
|
||||
|
||||
static int message_handler_req_lib_cfg_statetrackstart (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_cfg_statetrackstart (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_cfg_statetrackstop (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_cfg_statetrackstop (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_cfg_administrativestateset (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_cfg_administrativestateset (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int message_handler_req_lib_cfg_administrativestateget (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_lib_cfg_administrativestateget (struct conn_info *conn_info, void *message);
|
||||
|
||||
/*
|
||||
* Service Handler Definition
|
||||
*/
|
||||
struct libais_handler cfg_libais_handlers[] =
|
||||
static struct openais_lib_handler cfg_lib_handlers[] =
|
||||
{
|
||||
{ /* 0 */
|
||||
.libais_handler_fn = message_handler_req_lib_cfg_statetrackstart,
|
||||
.lib_handler_fn = message_handler_req_lib_cfg_statetrackstart,
|
||||
.response_size = sizeof (struct res_lib_cfg_statetrackstart),
|
||||
.response_id = MESSAGE_RES_CFG_STATETRACKSTART,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 1 */
|
||||
.libais_handler_fn = message_handler_req_lib_cfg_statetrackstop,
|
||||
.lib_handler_fn = message_handler_req_lib_cfg_statetrackstop,
|
||||
.response_size = sizeof (struct res_lib_cfg_statetrackstop),
|
||||
.response_id = MESSAGE_RES_CFG_STATETRACKSTOP,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 2 */
|
||||
.libais_handler_fn = message_handler_req_lib_cfg_administrativestateset,
|
||||
.lib_handler_fn = message_handler_req_lib_cfg_administrativestateset,
|
||||
.response_size = sizeof (struct res_lib_cfg_administrativestateset),
|
||||
.response_id = MESSAGE_RES_CFG_ADMINISTRATIVESTATESET,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 3 */
|
||||
.libais_handler_fn = message_handler_req_lib_cfg_administrativestateget,
|
||||
.lib_handler_fn = message_handler_req_lib_cfg_administrativestateget,
|
||||
.response_size = sizeof (struct res_lib_cfg_administrativestateget),
|
||||
.response_id = MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
}
|
||||
};
|
||||
|
||||
int (*cfg_aisexec_handler_fns[]) (void *, struct in_addr source_addr, int endian_conversion_required) = {
|
||||
static struct openais_exec_handler cfg_exec_handlers[] =
|
||||
{
|
||||
{
|
||||
}
|
||||
/*
|
||||
message_handler_req_exec_cfg_componentregister,
|
||||
message_handler_req_exec_cfg_componentunregister,
|
||||
@ -128,44 +131,46 @@ int (*cfg_aisexec_handler_fns[]) (void *, struct in_addr source_addr, int endian
|
||||
/*
|
||||
* Exports the interface for the service
|
||||
*/
|
||||
struct service_handler cfg_service_handler = {
|
||||
.name = "openais configuration service",
|
||||
struct openais_service_handler cfg_service_handler = {
|
||||
.name = (unsigned char*)"openais configuration service",
|
||||
.id = CFG_SERVICE,
|
||||
.libais_handlers = cfg_libais_handlers,
|
||||
.libais_handlers_count = sizeof (cfg_libais_handlers) / sizeof (struct libais_handler),
|
||||
.aisexec_handler_fns = cfg_aisexec_handler_fns,
|
||||
.aisexec_handler_fns_count = sizeof (cfg_aisexec_handler_fns) / sizeof (int (*)),
|
||||
.confchg_fn = cfg_confchg_fn,
|
||||
.libais_init_two_fn = cfg_init_two_fn,
|
||||
.libais_exit_fn = cfg_exit_fn,
|
||||
.lib_init_fn = cfg_lib_init_fn,
|
||||
.lib_exit_fn = cfg_lib_exit_fn,
|
||||
.lib_handlers = cfg_lib_handlers,
|
||||
.lib_handlers_count = sizeof (cfg_lib_handlers) / sizeof (struct openais_lib_handler),
|
||||
.exec_init_fn = cfg_exec_init_fn,
|
||||
.exec_handlers = cfg_exec_handlers,
|
||||
.exec_handlers_count = 0, /* sizeof (cfg_aisexec_handler_fns) / sizeof (openais_exec_handler), */
|
||||
.confchg_fn = cfg_confchg_fn,
|
||||
};
|
||||
|
||||
/*
|
||||
* Dynamic Loader definition
|
||||
*/
|
||||
#ifdef BUILD_DYNAMIC
|
||||
|
||||
struct service_handler *cfg_get_handler_ver0 (void);
|
||||
struct openais_service_handler *cfg_get_handler_ver0 (void);
|
||||
|
||||
struct aisexec_iface_ver0 cfg_service_handler_iface = {
|
||||
.test = NULL,
|
||||
.get_handler_ver0 = cfg_get_handler_ver0
|
||||
struct openais_service_handler_iface_ver0 cfg_service_handler_iface = {
|
||||
.openais_get_service_handler_ver0 = cfg_get_handler_ver0
|
||||
};
|
||||
|
||||
struct lcr_iface openais_cfg_ver0[1] = {
|
||||
{
|
||||
.name = "openais_cfg",
|
||||
.version = 0,
|
||||
.name = "openais_cfg",
|
||||
.version = 0,
|
||||
.versions_replace = 0,
|
||||
.versions_replace_count = 0,
|
||||
.versions_replace_count = 0,
|
||||
.dependencies = 0,
|
||||
.dependency_count = 0,
|
||||
.constructor = NULL,
|
||||
.destructor = NULL,
|
||||
.interfaces = (void **)&cfg_service_handler_iface,
|
||||
.destructor = NULL,
|
||||
.interfaces = (void **)&cfg_service_handler_iface,
|
||||
}
|
||||
};
|
||||
|
||||
struct lcr_comp cfg_comp_ver0 = {
|
||||
.iface_count = 1,
|
||||
.iface_count = 1,
|
||||
.ifaces = openais_cfg_ver0
|
||||
};
|
||||
|
||||
@ -175,37 +180,37 @@ extern int lcr_comp_get (struct lcr_comp **component)
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct service_handler *cfg_get_handler_ver0 (void)
|
||||
struct openais_service_handler *cfg_get_handler_ver0 (void)
|
||||
{
|
||||
return (&cfg_service_handler);
|
||||
}
|
||||
#endif /* BUILD_DYNAMIC */
|
||||
|
||||
/* IMPL */
|
||||
|
||||
static int cfg_exec_init_fn (struct openais_config *openais_config)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
static int cfg_confchg_fn (
|
||||
static void cfg_confchg_fn (
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct in_addr *member_list, int member_list_entries,
|
||||
struct in_addr *left_list, int left_list_entries,
|
||||
struct in_addr *joined_list, int joined_list_entries,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
struct totem_ip_address *joined_list, int joined_list_entries,
|
||||
struct memb_ring_id *ring_id)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
int cfg_exit_fn (struct conn_info *conn_info)
|
||||
int cfg_lib_exit_fn (struct conn_info *conn_info)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int cfg_init_two_fn (struct conn_info *conn_info)
|
||||
static int cfg_lib_init_fn (struct conn_info *conn_info)
|
||||
{
|
||||
log_printf (LOG_LEVEL_DEBUG, "Got request to initalize configuration service.\n");
|
||||
|
||||
list_init (&conn_info->conn_list);
|
||||
// list_init (&conn_info->conn_list);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -213,37 +218,32 @@ static int cfg_init_two_fn (struct conn_info *conn_info)
|
||||
/*
|
||||
* Library Interface Implementation
|
||||
*/
|
||||
static int message_handler_req_lib_cfg_statetrackstart (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_cfg_statetrackstart (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_cfg_statetrackstart *req_lib_cfg_statetrackstart = (struct req_lib_cfg_statetrackstart *)message;
|
||||
// struct req_lib_cfg_statetrackstart *req_lib_cfg_statetrackstart = (struct req_lib_cfg_statetrackstart *)message;
|
||||
|
||||
log_printf (LOG_LEVEL_FROM_LIB,
|
||||
"Handle : message_handler_req_lib_cfg_statetrackstart()\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_cfg_statetrackstop (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_cfg_statetrackstop (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_cfg_statetrackstop *req_lib_cfg_statetrackstop = (struct req_lib_cfg_statetrackstop *)message;
|
||||
// struct req_lib_cfg_statetrackstop *req_lib_cfg_statetrackstop = (struct req_lib_cfg_statetrackstop *)message;
|
||||
|
||||
log_printf (LOG_LEVEL_FROM_LIB,
|
||||
"Handle : message_handler_req_lib_cfg_administrativestateget()\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_cfg_administrativestateset (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_cfg_administrativestateset (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_cfg_administrativestateset *req_lib_cfg_administrativestateset = (struct req_lib_cfg_administrativestateset *)message;
|
||||
// struct req_lib_cfg_administrativestateset *req_lib_cfg_administrativestateset = (struct req_lib_cfg_administrativestateset *)message;
|
||||
log_printf (LOG_LEVEL_FROM_LIB,
|
||||
"Handle : message_handler_req_lib_cfg_administrativestateset()\n");
|
||||
return (0);
|
||||
}
|
||||
static int message_handler_req_lib_cfg_administrativestateget (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_cfg_administrativestateget (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_cfg_administrativestateget *req_lib_cfg_administrativestateget = (struct req_lib_cfg_administrativestateget *)message;
|
||||
// struct req_lib_cfg_administrativestateget *req_lib_cfg_administrativestateget = (struct req_lib_cfg_administrativestateget *)message;
|
||||
log_printf (LOG_LEVEL_FROM_LIB,
|
||||
"Handle : message_handler_req_lib_cfg_administrativestateget()\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
506
exec/ckpt.c
506
exec/ckpt.c
File diff suppressed because it is too large
Load Diff
@ -82,6 +82,6 @@ struct libckpt_ci {
|
||||
struct saCkptSectionIterator sectionIterator;
|
||||
};
|
||||
|
||||
extern struct service_handler ckpt_service_handler;
|
||||
extern struct openais_service_handler ckpt_service_handler;
|
||||
|
||||
#endif /* CKPT_H_DEFINED */
|
||||
|
135
exec/clm.c
135
exec/clm.c
@ -77,9 +77,9 @@ SaClmClusterNodeT thisClusterNode;
|
||||
|
||||
#define NODE_MAX 16
|
||||
|
||||
SaClmClusterNodeT clusterNodes[NODE_MAX];
|
||||
static SaClmClusterNodeT clusterNodes[NODE_MAX];
|
||||
|
||||
int clusterNodeEntries = 0;
|
||||
static int clusterNodeEntries = 0;
|
||||
|
||||
static unsigned long long view_current = 0;
|
||||
|
||||
@ -107,7 +107,7 @@ SaClmClusterNodeT *clm_get_by_nodeid (unsigned int node_id)
|
||||
/*
|
||||
* Service Interfaces required by service_message_handler struct
|
||||
*/
|
||||
static int clm_confchg_fn (
|
||||
static void clm_confchg_fn (
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
@ -124,86 +124,93 @@ static void clm_sync_abort (void);
|
||||
|
||||
static int clm_exec_init_fn (struct openais_config *);
|
||||
|
||||
static int clm_init_two_fn (struct conn_info *conn_info);
|
||||
static int clm_lib_init_fn (struct conn_info *conn_info);
|
||||
|
||||
static int clm_exit_fn (struct conn_info *conn_info);
|
||||
static int clm_lib_exit_fn (struct conn_info *conn_info);
|
||||
|
||||
static int message_handler_req_exec_clm_nodejoin (void *message, struct totem_ip_address *source_addr,
|
||||
int endian_conversion_required);
|
||||
static void message_handler_req_exec_clm_nodejoin (
|
||||
void *message,
|
||||
struct totem_ip_address *source_addr);
|
||||
|
||||
static int message_handler_req_lib_clm_clustertrack (struct conn_info *conn_info,
|
||||
static void exec_clm_nodejoin_endian_convert (void *msg);
|
||||
|
||||
static void message_handler_req_lib_clm_clustertrack (struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int message_handler_req_lib_clm_trackstop (struct conn_info *conn_info,
|
||||
static void message_handler_req_lib_clm_trackstop (struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int message_handler_req_lib_clm_nodeget (struct conn_info *conn_info,
|
||||
static void message_handler_req_lib_clm_nodeget (struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int message_handler_req_lib_clm_nodegetasync (struct conn_info *conn_info,
|
||||
static void message_handler_req_lib_clm_nodegetasync (struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int clm_exit_fn (struct conn_info *conn_info);
|
||||
|
||||
/*
|
||||
* Executive Handler Definition
|
||||
*/
|
||||
struct libais_handler clm_libais_handlers[] =
|
||||
static struct openais_lib_handler clm_lib_handlers[] =
|
||||
{
|
||||
{ /* 0 */
|
||||
.libais_handler_fn = message_handler_req_lib_clm_clustertrack,
|
||||
.lib_handler_fn = message_handler_req_lib_clm_clustertrack,
|
||||
.response_size = sizeof (struct res_lib_clm_clustertrack),
|
||||
.response_id = MESSAGE_RES_CLM_TRACKSTART, // TODO RESPONSE
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 1 */
|
||||
.libais_handler_fn = message_handler_req_lib_clm_trackstop,
|
||||
.lib_handler_fn = message_handler_req_lib_clm_trackstop,
|
||||
.response_size = sizeof (struct res_lib_clm_trackstop),
|
||||
.response_id = MESSAGE_RES_CLM_TRACKSTOP, // TODO RESPONSE
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 2 */
|
||||
.libais_handler_fn = message_handler_req_lib_clm_nodeget,
|
||||
.lib_handler_fn = message_handler_req_lib_clm_nodeget,
|
||||
.response_size = sizeof (struct res_clm_nodeget),
|
||||
.response_id = MESSAGE_RES_CLM_NODEGET, // TODO RESPONSE
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 3 */
|
||||
.libais_handler_fn = message_handler_req_lib_clm_nodegetasync,
|
||||
.lib_handler_fn = message_handler_req_lib_clm_nodegetasync,
|
||||
.response_size = sizeof (struct res_clm_nodegetasync),
|
||||
.response_id = MESSAGE_RES_CLM_NODEGETCALLBACK, // TODO RESPONSE
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
}
|
||||
};
|
||||
|
||||
static int (*clm_aisexec_handler_fns[]) (void *, struct totem_ip_address *source_addr, int endian_conversion_required) = {
|
||||
message_handler_req_exec_clm_nodejoin
|
||||
static struct openais_exec_handler clm_exec_handlers[] =
|
||||
{
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_clm_nodejoin,
|
||||
.exec_endian_convert_fn = exec_clm_nodejoin_endian_convert
|
||||
}
|
||||
};
|
||||
|
||||
struct service_handler clm_service_handler = {
|
||||
.name = "openais cluster membership service B.01.01",
|
||||
struct openais_service_handler clm_service_handler = {
|
||||
.name = (unsigned char*)"openais cluster membership service B.01.01",
|
||||
.id = CLM_SERVICE,
|
||||
.libais_handlers = clm_libais_handlers,
|
||||
.libais_handlers_count = sizeof (clm_libais_handlers) / sizeof (struct libais_handler),
|
||||
.aisexec_handler_fns = clm_aisexec_handler_fns,
|
||||
.aisexec_handler_fns_count = sizeof (clm_aisexec_handler_fns) / sizeof (int (*)),
|
||||
.confchg_fn = clm_confchg_fn,
|
||||
.libais_init_two_fn = clm_init_two_fn,
|
||||
.libais_exit_fn = clm_exit_fn,
|
||||
.lib_init_fn = clm_lib_init_fn,
|
||||
.lib_exit_fn = clm_lib_exit_fn,
|
||||
.lib_handlers = clm_lib_handlers,
|
||||
.lib_handlers_count = sizeof (clm_lib_handlers) / sizeof (struct openais_lib_handler),
|
||||
.exec_init_fn = clm_exec_init_fn,
|
||||
.exec_dump_fn = 0,
|
||||
.exec_dump_fn = NULL,
|
||||
.exec_handlers = clm_exec_handlers,
|
||||
.exec_handlers_count = sizeof (clm_exec_handlers) / sizeof (struct openais_exec_handler),
|
||||
.confchg_fn = clm_confchg_fn,
|
||||
.sync_init = clm_sync_init,
|
||||
.sync_process = clm_sync_process,
|
||||
.sync_activate = clm_sync_activate,
|
||||
.sync_abort = clm_sync_abort,
|
||||
};
|
||||
|
||||
/*
|
||||
* Dynamic loader definition
|
||||
*/
|
||||
#ifdef BUILD_DYNAMIC
|
||||
struct service_handler *clm_get_handler_ver0 (void);
|
||||
struct openais_service_handler *clm_get_service_handler_ver0 (void);
|
||||
|
||||
struct aisexec_iface_ver0 clm_service_handler_iface = {
|
||||
.test = NULL,
|
||||
.get_handler_ver0 = clm_get_handler_ver0
|
||||
struct openais_service_handler_iface_ver0 clm_service_handler_iface = {
|
||||
.openais_get_service_handler_ver0 = clm_get_service_handler_ver0
|
||||
};
|
||||
|
||||
struct lcr_iface openais_clm_ver0[1] = {
|
||||
@ -226,13 +233,13 @@ struct lcr_comp clm_comp_ver0 = {
|
||||
};
|
||||
|
||||
|
||||
extern int lcr_comp_get (struct lcr_comp **component)
|
||||
int lcr_comp_get (struct lcr_comp **component)
|
||||
{
|
||||
*component = &clm_comp_ver0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct service_handler *clm_get_handler_ver0 (void)
|
||||
struct openais_service_handler *clm_get_service_handler_ver0 (void)
|
||||
{
|
||||
return (&clm_service_handler);
|
||||
}
|
||||
@ -286,7 +293,7 @@ static int clm_exec_init_fn (struct openais_config *openais_config)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int clm_exit_fn (struct conn_info *conn_info)
|
||||
static int clm_lib_exit_fn (struct conn_info *conn_info)
|
||||
{
|
||||
/*
|
||||
* Delete track entry if there is one
|
||||
@ -296,7 +303,7 @@ static int clm_exit_fn (struct conn_info *conn_info)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void library_notification_send (SaClmClusterNotificationT *cluster_notification_entries,
|
||||
static void library_notification_send (SaClmClusterNotificationT *cluster_notification_entries,
|
||||
int notify_entries)
|
||||
{
|
||||
struct res_lib_clm_clustertrack res_lib_clm_clustertrack;
|
||||
@ -441,7 +448,7 @@ static int clm_nodejoin_send (void)
|
||||
return (result);
|
||||
}
|
||||
|
||||
static int clm_confchg_fn (
|
||||
static void clm_confchg_fn (
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
@ -496,7 +503,6 @@ static int clm_confchg_fn (
|
||||
(char *)thisClusterNode.nodeAddress.value);
|
||||
thisClusterNode.nodeName.length = thisClusterNode.nodeAddress.length;
|
||||
thisClusterNode.nodeId = this_ip->nodeid;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -536,32 +542,18 @@ static void clm_sync_abort (void)
|
||||
}
|
||||
|
||||
|
||||
static void exec_clm_nodejoin_endian_conversion (struct req_exec_clm_nodejoin *in,
|
||||
struct req_exec_clm_nodejoin *out)
|
||||
static void exec_clm_nodejoin_endian_convert (void *msg)
|
||||
{
|
||||
// TODO this isn't complete yet
|
||||
// TODO SaNameT needs to be packed and aligned
|
||||
memmove (&out->clusterNode.nodeName.value[0],
|
||||
&in->clusterNode.nodeName.value[2],
|
||||
SA_MAX_NAME_LENGTH);
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_clm_nodejoin (void *message, struct totem_ip_address *source_addr,
|
||||
int endian_conversion_required)
|
||||
static void message_handler_req_exec_clm_nodejoin (
|
||||
void *message,
|
||||
struct totem_ip_address *source_addr)
|
||||
{
|
||||
struct req_exec_clm_nodejoin *req_exec_clm_nodejoin = (struct req_exec_clm_nodejoin *)message;
|
||||
struct req_exec_clm_nodejoin req_exec_clm_nodejoin_storage;
|
||||
int found = 0;
|
||||
int i;
|
||||
|
||||
if (endian_conversion_required) {
|
||||
exec_clm_nodejoin_endian_conversion (message, &req_exec_clm_nodejoin_storage);
|
||||
req_exec_clm_nodejoin = &req_exec_clm_nodejoin_storage;
|
||||
} else {
|
||||
req_exec_clm_nodejoin = (struct req_exec_clm_nodejoin *)message;
|
||||
}
|
||||
|
||||
|
||||
log_printf (LOG_LEVEL_NOTICE, "got nodejoin message %s\n", req_exec_clm_nodejoin->clusterNode.nodeName.value);
|
||||
|
||||
/*
|
||||
@ -584,11 +576,9 @@ static int message_handler_req_exec_clm_nodejoin (void *message, struct totem_ip
|
||||
|
||||
clusterNodeEntries += 1;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int clm_init_two_fn (struct conn_info *conn_info)
|
||||
static int clm_lib_init_fn (struct conn_info *conn_info)
|
||||
{
|
||||
log_printf (LOG_LEVEL_DEBUG, "Got request to initalize cluster membership service.\n");
|
||||
|
||||
@ -597,7 +587,7 @@ static int clm_init_two_fn (struct conn_info *conn_info)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int message_handler_req_lib_clm_clustertrack (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_clm_clustertrack (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_clm_clustertrack *req_lib_clm_clustertrack = (struct req_lib_clm_clustertrack *)message;
|
||||
struct res_lib_clm_clustertrack res_lib_clm_clustertrack;
|
||||
@ -644,11 +634,10 @@ int message_handler_req_lib_clm_clustertrack (struct conn_info *conn_info, void
|
||||
&res_lib_clm_clustertrack,
|
||||
sizeof (struct res_lib_clm_clustertrack));
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
static int message_handler_req_lib_clm_trackstop (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_clm_trackstop (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct res_lib_clm_trackstop res_lib_clm_trackstop;
|
||||
|
||||
@ -668,11 +657,9 @@ static int message_handler_req_lib_clm_trackstop (struct conn_info *conn_info, v
|
||||
|
||||
libais_send_response (conn_info, &res_lib_clm_trackstop,
|
||||
sizeof (struct res_lib_clm_trackstop));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_clm_nodeget (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_clm_nodeget (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_clm_nodeget *req_lib_clm_nodeget = (struct req_lib_clm_nodeget *)message;
|
||||
struct res_clm_nodeget res_clm_nodeget;
|
||||
@ -704,11 +691,9 @@ static int message_handler_req_lib_clm_nodeget (struct conn_info *conn_info, voi
|
||||
memcpy (&res_clm_nodeget.clusterNode, clusterNode, sizeof (SaClmClusterNodeT));
|
||||
}
|
||||
libais_send_response (conn_info, &res_clm_nodeget, sizeof (struct res_clm_nodeget));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_clm_nodegetasync (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_clm_nodegetasync (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_clm_nodegetasync *req_lib_clm_nodegetasync = (struct req_lib_clm_nodegetasync *)message;
|
||||
struct res_clm_nodegetasync res_clm_nodegetasync;
|
||||
@ -754,6 +739,4 @@ static int message_handler_req_lib_clm_nodegetasync (struct conn_info *conn_info
|
||||
}
|
||||
libais_send_response (conn_info->conn_info_partner, &res_clm_nodegetcallback,
|
||||
sizeof (struct res_clm_nodegetcallback));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -47,6 +47,6 @@ struct libclm_ci {
|
||||
|
||||
extern SaClmClusterNodeT *clm_get_by_nodeid (unsigned int node_id);
|
||||
|
||||
extern struct service_handler clm_service_handler;
|
||||
extern struct openais_service_handler clm_service_handler;
|
||||
|
||||
#endif /* CLM_H_DEFINED */
|
||||
|
141
exec/evs.c
141
exec/evs.c
@ -73,88 +73,94 @@ enum evs_exec_message_req_types {
|
||||
/*
|
||||
* Service Interfaces required by service_message_handler struct
|
||||
*/
|
||||
static int evs_executive_initialize (struct openais_config *);
|
||||
|
||||
static int evs_confchg_fn (
|
||||
static void evs_confchg_fn (
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
struct totem_ip_address *joined_list, int joined_list_entries,
|
||||
struct memb_ring_id *ring_id);
|
||||
|
||||
static int evs_init_two_fn (struct conn_info *conn_info);
|
||||
static void message_handler_req_exec_mcast (void *message, struct totem_ip_address *source_addr);
|
||||
|
||||
static int message_handler_req_exec_mcast (void *message, struct totem_ip_address *source_addr, int endian_conversion_required);
|
||||
static void req_exec_mcast_endian_convert (void *msg);
|
||||
|
||||
static int message_handler_req_evs_join (struct conn_info *conn_info, void *message);
|
||||
static int message_handler_req_evs_leave (struct conn_info *conn_info, void *message);
|
||||
static int message_handler_req_evs_mcast_joined (struct conn_info *conn_info, void *message);
|
||||
static int message_handler_req_evs_mcast_groups (struct conn_info *conn_info, void *message);
|
||||
static int message_handler_req_evs_membership_get (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_evs_join (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_evs_leave (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_evs_mcast_joined (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_evs_mcast_groups (struct conn_info *conn_info, void *message);
|
||||
static void message_handler_req_evs_membership_get (struct conn_info *conn_info, void *message);
|
||||
|
||||
static int evs_exit_fn (struct conn_info *conn_info);
|
||||
static int evs_lib_init_fn (struct conn_info *conn_info);
|
||||
static int evs_lib_exit_fn (struct conn_info *conn_info);
|
||||
|
||||
struct libais_handler evs_libais_handlers[] =
|
||||
static struct openais_lib_handler evs_lib_handlers[] =
|
||||
{
|
||||
{ /* 0 */
|
||||
.libais_handler_fn = message_handler_req_evs_join,
|
||||
.lib_handler_fn = message_handler_req_evs_join,
|
||||
.response_size = sizeof (struct res_lib_evs_join),
|
||||
.response_id = MESSAGE_RES_EVS_JOIN,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 1 */
|
||||
.libais_handler_fn = message_handler_req_evs_leave,
|
||||
.lib_handler_fn = message_handler_req_evs_leave,
|
||||
.response_size = sizeof (struct res_lib_evs_leave),
|
||||
.response_id = MESSAGE_RES_EVS_LEAVE,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{ /* 2 */
|
||||
.libais_handler_fn = message_handler_req_evs_mcast_joined,
|
||||
.lib_handler_fn = message_handler_req_evs_mcast_joined,
|
||||
.response_size = sizeof (struct res_lib_evs_mcast_joined),
|
||||
.response_id = MESSAGE_RES_EVS_MCAST_JOINED,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 3 */
|
||||
.libais_handler_fn = message_handler_req_evs_mcast_groups,
|
||||
.lib_handler_fn = message_handler_req_evs_mcast_groups,
|
||||
.response_size = sizeof (struct res_lib_evs_mcast_groups),
|
||||
.response_id = MESSAGE_RES_EVS_MCAST_GROUPS,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 4 */
|
||||
.libais_handler_fn = message_handler_req_evs_membership_get,
|
||||
.lib_handler_fn = message_handler_req_evs_membership_get,
|
||||
.response_size = sizeof (struct res_lib_evs_membership_get),
|
||||
.response_id = MESSAGE_RES_EVS_MEMBERSHIP_GET,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
}
|
||||
};
|
||||
|
||||
static int (*evs_aisexec_handler_fns[]) (void *, struct totem_ip_address *source_addr, int endian_conversion_required) = {
|
||||
message_handler_req_exec_mcast
|
||||
static struct openais_exec_handler evs_exec_handlers[] =
|
||||
{
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_mcast,
|
||||
.exec_endian_convert_fn = req_exec_mcast_endian_convert
|
||||
}
|
||||
};
|
||||
|
||||
struct service_handler evs_service_handler = {
|
||||
.name = "openais extended virtual synchrony service",
|
||||
struct openais_service_handler evs_service_handler = {
|
||||
.name = (unsigned char*)"openais extended virtual synchrony service",
|
||||
.id = EVS_SERVICE,
|
||||
.libais_handlers = evs_libais_handlers,
|
||||
.libais_handlers_count = sizeof (evs_libais_handlers) / sizeof (struct libais_handler),
|
||||
.aisexec_handler_fns = evs_aisexec_handler_fns,
|
||||
.aisexec_handler_fns_count = sizeof (evs_aisexec_handler_fns) / sizeof (int (*)),
|
||||
.lib_init_fn = evs_lib_init_fn,
|
||||
.lib_exit_fn = evs_lib_exit_fn,
|
||||
.lib_handlers = evs_lib_handlers,
|
||||
.lib_handlers_count = sizeof (evs_lib_handlers) / sizeof (struct openais_lib_handler),
|
||||
.exec_handlers = evs_exec_handlers,
|
||||
.exec_handlers_count = sizeof (evs_exec_handlers) / sizeof (struct openais_exec_handler),
|
||||
.confchg_fn = evs_confchg_fn,
|
||||
.libais_init_two_fn = evs_init_two_fn,
|
||||
.libais_exit_fn = evs_exit_fn,
|
||||
.exec_init_fn = evs_executive_initialize,
|
||||
.exec_dump_fn = 0
|
||||
.exec_init_fn = NULL,
|
||||
.exec_dump_fn = NULL
|
||||
};
|
||||
|
||||
static DECLARE_LIST_INIT (confchg_notify);
|
||||
|
||||
/*
|
||||
* Dynamic loading descriptor
|
||||
*/
|
||||
|
||||
#ifdef BUILD_DYNAMIC
|
||||
|
||||
struct service_handler *evs_get_handler_ver0 (void);
|
||||
struct openais_service_handler *evs_get_service_handler_ver0 (void);
|
||||
|
||||
struct aisexec_iface_ver0 evs_service_handler_iface = {
|
||||
.test = NULL,
|
||||
.get_handler_ver0 = evs_get_handler_ver0
|
||||
struct openais_service_handler_iface_ver0 evs_service_handler_iface = {
|
||||
.openais_get_service_handler_ver0 = evs_get_service_handler_ver0
|
||||
};
|
||||
|
||||
struct lcr_iface openais_evs_ver0[1] = {
|
||||
@ -176,34 +182,22 @@ struct lcr_comp evs_comp_ver0 = {
|
||||
.ifaces = openais_evs_ver0
|
||||
};
|
||||
|
||||
extern int lcr_comp_get (struct lcr_comp **component)
|
||||
int lcr_comp_get (struct lcr_comp **component)
|
||||
{
|
||||
*component = &evs_comp_ver0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct service_handler *evs_get_handler_ver0 (void)
|
||||
struct openais_service_handler *evs_get_service_handler_ver0 (void)
|
||||
{
|
||||
return (&evs_service_handler);
|
||||
}
|
||||
|
||||
#endif /* BUILD_DYNAMIC */
|
||||
|
||||
static int evs_executive_initialize (struct openais_config *openais_config)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int evs_exit_fn (struct conn_info *conn_info)
|
||||
{
|
||||
|
||||
list_del (&conn_info->conn_list);
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct res_evs_confchg_callback res_evs_confchg_callback;
|
||||
|
||||
static int evs_confchg_fn (
|
||||
static void evs_confchg_fn (
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
@ -246,22 +240,27 @@ static int evs_confchg_fn (
|
||||
libais_send_response (conn_info, &res_evs_confchg_callback,
|
||||
sizeof (res_evs_confchg_callback));
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int evs_init_two_fn (struct conn_info *conn_info)
|
||||
static int evs_lib_init_fn (struct conn_info *conn_info)
|
||||
{
|
||||
log_printf (LOG_LEVEL_DEBUG, "Got request to initalize evs service.\n");
|
||||
list_init (&conn_info->conn_list);
|
||||
list_add (&conn_info->conn_list, &confchg_notify);
|
||||
|
||||
libais_send_response (conn_info, &res_evs_confchg_callback,
|
||||
sizeof (res_evs_confchg_callback));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_evs_join (struct conn_info *conn_info, void *message)
|
||||
static int evs_lib_exit_fn (struct conn_info *conn_info)
|
||||
{
|
||||
list_del (&conn_info->conn_list);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void message_handler_req_evs_join (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
evs_error_t error = EVS_OK;
|
||||
struct req_lib_evs_join *req_lib_evs_join = (struct req_lib_evs_join *)message;
|
||||
@ -303,11 +302,9 @@ exit_error:
|
||||
|
||||
libais_send_response (conn_info, &res_lib_evs_join,
|
||||
sizeof (struct res_lib_evs_join));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_evs_leave (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_evs_leave (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_evs_leave *req_lib_evs_leave = (struct req_lib_evs_leave *)message;
|
||||
struct res_lib_evs_leave res_lib_evs_leave;
|
||||
@ -358,11 +355,9 @@ static int message_handler_req_evs_leave (struct conn_info *conn_info, void *mes
|
||||
|
||||
libais_send_response (conn_info, &res_lib_evs_leave,
|
||||
sizeof (struct res_lib_evs_leave));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_evs_mcast_joined (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_evs_mcast_joined (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
evs_error_t error = EVS_ERR_TRY_AGAIN;
|
||||
struct req_lib_evs_mcast_joined *req_lib_evs_mcast_joined = (struct req_lib_evs_mcast_joined *)message;
|
||||
@ -403,11 +398,9 @@ static int message_handler_req_evs_mcast_joined (struct conn_info *conn_info, vo
|
||||
|
||||
libais_send_response (conn_info, &res_lib_evs_mcast_joined,
|
||||
sizeof (struct res_lib_evs_mcast_joined));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_evs_mcast_groups (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_evs_mcast_groups (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
evs_error_t error = EVS_ERR_TRY_AGAIN;
|
||||
struct req_lib_evs_mcast_groups *req_lib_evs_mcast_groups = (struct req_lib_evs_mcast_groups *)message;
|
||||
@ -451,10 +444,9 @@ static int message_handler_req_evs_mcast_groups (struct conn_info *conn_info, vo
|
||||
|
||||
libais_send_response (conn_info, &res_lib_evs_mcast_groups,
|
||||
sizeof (struct res_lib_evs_mcast_groups));
|
||||
|
||||
return (0);
|
||||
}
|
||||
static int message_handler_req_evs_membership_get (struct conn_info *conn_info, void *message)
|
||||
|
||||
static void message_handler_req_evs_membership_get (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct res_lib_evs_membership_get res_lib_evs_membership_get;
|
||||
|
||||
@ -472,11 +464,13 @@ static int message_handler_req_evs_membership_get (struct conn_info *conn_info,
|
||||
|
||||
libais_send_response (conn_info, &res_lib_evs_membership_get,
|
||||
sizeof (struct res_lib_evs_membership_get));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_mcast (void *message, struct totem_ip_address *source_addr, int endian_conversion_required)
|
||||
static void req_exec_mcast_endian_convert (void *msg)
|
||||
{
|
||||
}
|
||||
|
||||
static void message_handler_req_exec_mcast (void *message, struct totem_ip_address *source_addr)
|
||||
{
|
||||
struct req_exec_evs_mcast *req_exec_evs_mcast = (struct req_exec_evs_mcast *)message;
|
||||
struct res_evs_deliver_callback res_evs_deliver_callback;
|
||||
@ -523,7 +517,4 @@ static int message_handler_req_exec_mcast (void *message, struct totem_ip_addres
|
||||
req_exec_evs_mcast->msg_len);
|
||||
}
|
||||
}
|
||||
//TODO printf ("Got evs message %s\n", msg_addr);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -44,6 +44,6 @@ struct libevs_ci {
|
||||
int group_entries;
|
||||
};
|
||||
|
||||
extern struct service_handler evs_service_handler;
|
||||
extern struct openais_service_handler evs_service_handler;
|
||||
|
||||
#endif /* EVS_H_DEFINED */
|
||||
|
226
exec/evt.c
226
exec/evt.c
@ -72,30 +72,30 @@ enum evt_message_req_types {
|
||||
MESSAGE_REQ_EXEC_EVT_RECOVERY_EVENTDATA = 2
|
||||
};
|
||||
|
||||
static int lib_evt_open_channel(struct conn_info *conn_info, void *message);
|
||||
static int lib_evt_open_channel_async(struct conn_info *conn_info,
|
||||
static void lib_evt_open_channel(struct conn_info *conn_info, void *message);
|
||||
static void lib_evt_open_channel_async(struct conn_info *conn_info,
|
||||
void *message);
|
||||
static int lib_evt_close_channel(struct conn_info *conn_info, void *message);
|
||||
static int lib_evt_unlink_channel(struct conn_info *conn_info, void *message);
|
||||
static int lib_evt_event_subscribe(struct conn_info *conn_info,
|
||||
static void lib_evt_close_channel(struct conn_info *conn_info, void *message);
|
||||
static void lib_evt_unlink_channel(struct conn_info *conn_info, void *message);
|
||||
static void lib_evt_event_subscribe(struct conn_info *conn_info,
|
||||
void *message);
|
||||
static int lib_evt_event_unsubscribe(struct conn_info *conn_info,
|
||||
static void lib_evt_event_unsubscribe(struct conn_info *conn_info,
|
||||
void *message);
|
||||
static int lib_evt_event_publish(struct conn_info *conn_info, void *message);
|
||||
static int lib_evt_event_clear_retentiontime(struct conn_info *conn_info,
|
||||
static void lib_evt_event_publish(struct conn_info *conn_info, void *message);
|
||||
static void lib_evt_event_clear_retentiontime(struct conn_info *conn_info,
|
||||
void *message);
|
||||
static int lib_evt_event_data_get(struct conn_info *conn_info,
|
||||
static void lib_evt_event_data_get(struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int evt_conf_change(
|
||||
static void evt_conf_change(
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
struct totem_ip_address *joined_list, int joined_list_entries,
|
||||
struct memb_ring_id *ring_id);
|
||||
|
||||
static int evt_initialize(struct conn_info *conn_info);
|
||||
static int evt_finalize(struct conn_info *conn_info);
|
||||
static int evt_lib_init(struct conn_info *conn_info);
|
||||
static int evt_lib_exit(struct conn_info *conn_info);
|
||||
static int evt_exec_init(struct openais_config *openais_config);
|
||||
|
||||
/*
|
||||
@ -106,94 +106,99 @@ static int evt_sync_process(void);
|
||||
static void evt_sync_activate(void);
|
||||
static void evt_sync_abort(void);
|
||||
|
||||
static void convert_event(void *msg);
|
||||
static void convert_chan_packet(void *msg);
|
||||
|
||||
static struct libais_handler evt_libais_handlers[] = {
|
||||
static struct openais_lib_handler evt_lib_handlers[] = {
|
||||
{
|
||||
.libais_handler_fn = lib_evt_open_channel,
|
||||
.lib_handler_fn = lib_evt_open_channel,
|
||||
.response_size = sizeof(struct res_evt_channel_open),
|
||||
.response_id = MESSAGE_RES_EVT_OPEN_CHANNEL,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{
|
||||
.libais_handler_fn = lib_evt_open_channel_async,
|
||||
.lib_handler_fn = lib_evt_open_channel_async,
|
||||
.response_size = sizeof(struct res_evt_channel_open),
|
||||
.response_id = MESSAGE_RES_EVT_OPEN_CHANNEL,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{
|
||||
.libais_handler_fn = lib_evt_close_channel,
|
||||
.lib_handler_fn = lib_evt_close_channel,
|
||||
.response_size = sizeof(struct res_evt_channel_close),
|
||||
.response_id = MESSAGE_RES_EVT_CLOSE_CHANNEL,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{
|
||||
.libais_handler_fn = lib_evt_unlink_channel,
|
||||
.lib_handler_fn = lib_evt_unlink_channel,
|
||||
.response_size = sizeof(struct res_evt_channel_unlink),
|
||||
.response_id = MESSAGE_RES_EVT_UNLINK_CHANNEL,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{
|
||||
.libais_handler_fn = lib_evt_event_subscribe,
|
||||
.lib_handler_fn = lib_evt_event_subscribe,
|
||||
.response_size = sizeof(struct res_evt_event_subscribe),
|
||||
.response_id = MESSAGE_RES_EVT_SUBSCRIBE,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{
|
||||
.libais_handler_fn = lib_evt_event_unsubscribe,
|
||||
.lib_handler_fn = lib_evt_event_unsubscribe,
|
||||
.response_size = sizeof(struct res_evt_event_unsubscribe),
|
||||
.response_id = MESSAGE_RES_EVT_UNSUBSCRIBE,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
{
|
||||
.libais_handler_fn = lib_evt_event_publish,
|
||||
.lib_handler_fn = lib_evt_event_publish,
|
||||
.response_size = sizeof(struct res_evt_event_publish),
|
||||
.response_id = MESSAGE_RES_EVT_PUBLISH,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{
|
||||
.libais_handler_fn = lib_evt_event_clear_retentiontime,
|
||||
.lib_handler_fn = lib_evt_event_clear_retentiontime,
|
||||
.response_size = sizeof(struct res_evt_event_clear_retentiontime),
|
||||
.response_id = MESSAGE_RES_EVT_CLEAR_RETENTIONTIME,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{
|
||||
.libais_handler_fn = lib_evt_event_data_get,
|
||||
.lib_handler_fn = lib_evt_event_data_get,
|
||||
.response_size = sizeof(struct lib_event_data),
|
||||
.response_id = MESSAGE_RES_EVT_EVENT_DATA,
|
||||
.flow_control = FLOW_CONTROL_NOT_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_NOT_REQUIRED
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static int evt_remote_evt(void *msg, struct totem_ip_address *source_addr,
|
||||
int endian_conversion_required);
|
||||
static int evt_remote_recovery_evt(void *msg, struct totem_ip_address *source_addr,
|
||||
int endian_conversion_required);
|
||||
static int evt_remote_chan_op(void *msg, struct totem_ip_address *source_addr,
|
||||
int endian_conversion_required);
|
||||
static void evt_remote_evt(void *msg, struct totem_ip_address *source_addr);
|
||||
static void evt_remote_recovery_evt(void *msg, struct totem_ip_address *source_addr);
|
||||
static void evt_remote_chan_op(void *msg, struct totem_ip_address *source_addr);
|
||||
|
||||
static int (*evt_exec_handler_fns[]) (void *m, struct totem_ip_address *s,
|
||||
int endian_conversion_required) = {
|
||||
evt_remote_evt,
|
||||
evt_remote_chan_op,
|
||||
evt_remote_recovery_evt
|
||||
static struct openais_exec_handler evt_exec_handlers[] = {
|
||||
{
|
||||
.exec_handler_fn = evt_remote_evt,
|
||||
.exec_endian_convert_fn = convert_event
|
||||
},
|
||||
{
|
||||
.exec_handler_fn = evt_remote_chan_op,
|
||||
.exec_endian_convert_fn = convert_chan_packet
|
||||
},
|
||||
{
|
||||
.exec_handler_fn = evt_remote_recovery_evt,
|
||||
.exec_endian_convert_fn = convert_event
|
||||
}
|
||||
};
|
||||
|
||||
struct service_handler evt_service_handler = {
|
||||
struct openais_service_handler evt_service_handler = {
|
||||
.name =
|
||||
(unsigned char*)"openais event service B.01.01",
|
||||
.id = EVT_SERVICE,
|
||||
.libais_handlers = evt_libais_handlers,
|
||||
.libais_handlers_count = sizeof(evt_libais_handlers) /
|
||||
sizeof(struct libais_handler),
|
||||
.aisexec_handler_fns = evt_exec_handler_fns,
|
||||
.aisexec_handler_fns_count = sizeof(evt_exec_handler_fns) /
|
||||
sizeof(int (*)),
|
||||
.confchg_fn = evt_conf_change,
|
||||
.libais_init_two_fn = evt_initialize,
|
||||
.libais_exit_fn = evt_finalize,
|
||||
.lib_init_fn = evt_lib_init,
|
||||
.lib_exit_fn = evt_lib_exit,
|
||||
.lib_handlers = evt_lib_handlers,
|
||||
.lib_handlers_count = sizeof(evt_lib_handlers) / sizeof(struct openais_lib_handler),
|
||||
.exec_init_fn = evt_exec_init,
|
||||
.exec_dump_fn = 0,
|
||||
.exec_handlers = evt_exec_handlers,
|
||||
.exec_handlers_count = sizeof(evt_exec_handlers) / sizeof(struct openais_exec_handler),
|
||||
.exec_dump_fn = NULL,
|
||||
.confchg_fn = evt_conf_change,
|
||||
.sync_init = evt_sync_init,
|
||||
.sync_process = evt_sync_process,
|
||||
.sync_activate = evt_sync_activate,
|
||||
@ -201,11 +206,10 @@ struct service_handler evt_service_handler = {
|
||||
};
|
||||
|
||||
#ifdef BUILD_DYNAMIC
|
||||
struct service_handler *evt_get_handler_ver0 (void);
|
||||
struct openais_service_handler *evt_get_handler_ver0 (void);
|
||||
|
||||
struct aisexec_iface_ver0 evt_service_handler_iface = {
|
||||
.test = NULL,
|
||||
.get_handler_ver0 = evt_get_handler_ver0
|
||||
struct openais_service_handler_iface_ver0 evt_service_handler_iface = {
|
||||
.openais_get_service_handler_ver0 = evt_get_handler_ver0
|
||||
};
|
||||
|
||||
struct lcr_iface openais_evt_ver0[1] = {
|
||||
@ -233,7 +237,7 @@ extern int lcr_comp_get (struct lcr_comp **component)
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct service_handler *evt_get_handler_ver0 (void)
|
||||
struct openais_service_handler *evt_get_handler_ver0 (void)
|
||||
{
|
||||
return (&evt_service_handler);
|
||||
}
|
||||
@ -1526,7 +1530,6 @@ remove_delivered_channel(struct event_svr_channel_open *eco)
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1902,8 +1905,9 @@ deliver_event(struct event_data *evt,
|
||||
* word order.
|
||||
*/
|
||||
static void
|
||||
convert_event(struct lib_event_data *evt)
|
||||
convert_event(void *msg)
|
||||
{
|
||||
struct lib_event_data *evt = (struct lib_event_data *)msg;
|
||||
SaEvtEventPatternT *eps;
|
||||
int i;
|
||||
|
||||
@ -2064,7 +2068,7 @@ static struct event_svr_channel_subscr *find_subscr(
|
||||
/*
|
||||
* Handler for saEvtInitialize
|
||||
*/
|
||||
static int evt_initialize(struct conn_info *conn_info)
|
||||
static int evt_lib_init(struct conn_info *conn_info)
|
||||
{
|
||||
struct libevt_ci *libevt_ci;
|
||||
struct conn_info *resp_conn_info;
|
||||
@ -2107,7 +2111,7 @@ static int evt_initialize(struct conn_info *conn_info)
|
||||
/*
|
||||
* Handler for saEvtChannelOpen
|
||||
*/
|
||||
static int lib_evt_open_channel(struct conn_info *conn_info, void *message)
|
||||
static void lib_evt_open_channel(struct conn_info *conn_info, void *message)
|
||||
{
|
||||
SaAisErrorT error;
|
||||
struct req_evt_channel_open *req;
|
||||
@ -2169,7 +2173,7 @@ static int lib_evt_open_channel(struct conn_info *conn_info, void *message)
|
||||
"Error setting timeout for open channel %s\n",
|
||||
req->ico_channel_name.value);
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
|
||||
|
||||
open_return:
|
||||
@ -2177,14 +2181,12 @@ open_return:
|
||||
res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
|
||||
res.ico_head.error = error;
|
||||
libais_send_response (conn_info, &res, sizeof(res));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handler for saEvtChannelOpen
|
||||
*/
|
||||
static int lib_evt_open_channel_async(struct conn_info *conn_info,
|
||||
static void lib_evt_open_channel_async(struct conn_info *conn_info,
|
||||
void *message)
|
||||
{
|
||||
SaAisErrorT error;
|
||||
@ -2237,8 +2239,6 @@ open_return:
|
||||
res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
|
||||
res.ico_head.error = error;
|
||||
libais_send_response (conn_info, &res, sizeof(res));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -2296,7 +2296,7 @@ common_chan_close(struct event_svr_channel_open *eco, struct libevt_ci *esip)
|
||||
/*
|
||||
* Handler for saEvtChannelClose
|
||||
*/
|
||||
static int lib_evt_close_channel(struct conn_info *conn_info, void *message)
|
||||
static void lib_evt_close_channel(struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_evt_channel_close *req;
|
||||
struct res_evt_channel_close res;
|
||||
@ -2330,14 +2330,12 @@ chan_close_done:
|
||||
res.icc_head.id = MESSAGE_RES_EVT_CLOSE_CHANNEL;
|
||||
res.icc_head.error = ((ret == 0) ? SA_AIS_OK : SA_AIS_ERR_BAD_HANDLE);
|
||||
libais_send_response (conn_info, &res, sizeof(res));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handler for saEvtChannelUnlink
|
||||
*/
|
||||
static int lib_evt_unlink_channel(struct conn_info *conn_info, void *message)
|
||||
static void lib_evt_unlink_channel(struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_evt_channel_unlink *req;
|
||||
struct res_evt_channel_unlink res;
|
||||
@ -2391,7 +2389,7 @@ static int lib_evt_unlink_channel(struct conn_info *conn_info, void *message)
|
||||
chn_iovec.iov_base = &cpkt;
|
||||
chn_iovec.iov_len = cpkt.chc_head.size;
|
||||
if (totempg_groups_mcast_joined (openais_group_handle, &chn_iovec, 1, TOTEMPG_AGREED) == 0) {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
evt_unlink_err:
|
||||
@ -2403,7 +2401,6 @@ evt_unlink_err:
|
||||
res.iuc_head.id = MESSAGE_RES_EVT_UNLINK_CHANNEL;
|
||||
res.iuc_head.error = error;
|
||||
libais_send_response (conn_info, &res, sizeof(res));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2427,7 +2424,7 @@ static char *filter_types[] = {
|
||||
/*
|
||||
* saEvtEventSubscribe Handler
|
||||
*/
|
||||
static int lib_evt_event_subscribe(struct conn_info *conn_info, void *message)
|
||||
static void lib_evt_event_subscribe(struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_evt_event_subscribe *req;
|
||||
struct res_evt_event_subscribe res;
|
||||
@ -2530,7 +2527,7 @@ static int lib_evt_event_subscribe(struct conn_info *conn_info, void *message)
|
||||
}
|
||||
}
|
||||
hdb_handle_put(&esip->esi_hdb, req->ics_channel_handle);
|
||||
return 0;
|
||||
return;
|
||||
|
||||
subr_put:
|
||||
hdb_handle_put(&esip->esi_hdb, req->ics_channel_handle);
|
||||
@ -2539,14 +2536,12 @@ subr_done:
|
||||
res.ics_head.id = MESSAGE_RES_EVT_SUBSCRIBE;
|
||||
res.ics_head.error = error;
|
||||
libais_send_response (conn_info, &res, sizeof(res));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* saEvtEventUnsubscribe Handler
|
||||
*/
|
||||
static int lib_evt_event_unsubscribe(struct conn_info *conn_info,
|
||||
static void lib_evt_event_unsubscribe(struct conn_info *conn_info,
|
||||
void *message)
|
||||
{
|
||||
struct req_evt_event_unsubscribe *req;
|
||||
@ -2607,14 +2602,12 @@ unsubr_done:
|
||||
res.icu_head.id = MESSAGE_RES_EVT_UNSUBSCRIBE;
|
||||
res.icu_head.error = error;
|
||||
libais_send_response (conn_info, &res, sizeof(res));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* saEvtEventPublish Handler
|
||||
*/
|
||||
static int lib_evt_event_publish(struct conn_info *conn_info, void *message)
|
||||
static void lib_evt_event_publish(struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct lib_event_data *req;
|
||||
struct res_evt_event_publish res;
|
||||
@ -2679,14 +2672,12 @@ pub_done:
|
||||
res.iep_head.error = error;
|
||||
res.iep_event_id = event_id;
|
||||
libais_send_response (conn_info, &res, sizeof(res));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* saEvtEventRetentionTimeClear handler
|
||||
*/
|
||||
static int lib_evt_event_clear_retentiontime(struct conn_info *conn_info,
|
||||
static void lib_evt_event_clear_retentiontime(struct conn_info *conn_info,
|
||||
void *message)
|
||||
{
|
||||
struct req_evt_event_clear_retentiontime *req;
|
||||
@ -2731,7 +2722,8 @@ static int lib_evt_event_clear_retentiontime(struct conn_info *conn_info,
|
||||
rtn_iovec.iov_len = cpkt.chc_head.size;
|
||||
ret = totempg_groups_mcast_joined (openais_group_handle, &rtn_iovec, 1, TOTEMPG_AGREED);
|
||||
if (ret == 0) {
|
||||
return 0;
|
||||
// TODO this should really assert
|
||||
return;
|
||||
}
|
||||
error = SA_AIS_ERR_LIBRARY;
|
||||
|
||||
@ -2744,14 +2736,13 @@ evt_ret_clr_err:
|
||||
res.iec_head.id = MESSAGE_RES_EVT_CLEAR_RETENTIONTIME;
|
||||
res.iec_head.error = error;
|
||||
libais_send_response (conn_info, &res, sizeof(res));
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Send requested event data to the application
|
||||
*/
|
||||
static int lib_evt_event_data_get(struct conn_info *conn_info, void *message)
|
||||
static void lib_evt_event_data_get(struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct lib_event_data res;
|
||||
struct libevt_ci *esip = &conn_info->ais_ci.u.libevt_ci;
|
||||
@ -2801,7 +2792,6 @@ data_get_done:
|
||||
if (esip->esi_nevents) {
|
||||
__notify_event(conn_info);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2827,7 +2817,7 @@ static void remove_chan_open_info(SaClmNodeIdT node_id)
|
||||
* node list. The node list is used to keep track of event IDs
|
||||
* received for each node for the detection of duplicate events.
|
||||
*/
|
||||
static int evt_conf_change(
|
||||
static void evt_conf_change(
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
@ -2940,14 +2930,12 @@ static int evt_conf_change(
|
||||
sizeof(struct totem_ip_address) * member_list_entries);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* saEvtFinalize Handler
|
||||
*/
|
||||
static int evt_finalize(struct conn_info *conn_info)
|
||||
static int evt_lib_exit(struct conn_info *conn_info)
|
||||
{
|
||||
|
||||
struct libevt_ci *esip = &conn_info->conn_info_partner->ais_ci.u.libevt_ci;
|
||||
@ -3101,8 +3089,7 @@ try_deliver_event(struct event_data *evt,
|
||||
/*
|
||||
* Receive the network event message and distribute it to local subscribers
|
||||
*/
|
||||
static int evt_remote_evt(void *msg, struct totem_ip_address *source_addr,
|
||||
int endian_conversion_required)
|
||||
static void evt_remote_evt(void *msg, struct totem_ip_address *source_addr)
|
||||
{
|
||||
/*
|
||||
* - retain events that have a retention time
|
||||
@ -3131,15 +3118,11 @@ static int evt_remote_evt(void *msg, struct totem_ip_address *source_addr,
|
||||
log_printf(LOG_LEVEL_DEBUG, "No cluster node data for %s\n",
|
||||
totemip_print(source_addr));
|
||||
errno = ENXIO;
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
log_printf(LOG_LEVEL_DEBUG, "Cluster node ID 0x%x name %s\n",
|
||||
cn->nodeId, cn->nodeName.value);
|
||||
|
||||
if (endian_conversion_required) {
|
||||
convert_event(evtpkt);
|
||||
}
|
||||
|
||||
evtpkt->led_publisher_node_id = cn->nodeId;
|
||||
totemip_copy(&evtpkt->led_addr, source_addr);
|
||||
evtpkt->led_receive_time = clust_time_now();
|
||||
@ -3171,19 +3154,18 @@ static int evt_remote_evt(void *msg, struct totem_ip_address *source_addr,
|
||||
if (!eci) {
|
||||
log_printf(LOG_LEVEL_DEBUG, "Channel %s doesn't exist\n",
|
||||
evtpkt->led_chan_name.value);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (check_last_event(evtpkt, source_addr)) {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
evt = make_local_event(evtpkt, eci);
|
||||
if (!evt) {
|
||||
log_printf(LOG_LEVEL_WARNING,
|
||||
"1Memory allocation error, can't deliver event\n");
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt->ed_event.led_retention_time) {
|
||||
@ -3192,9 +3174,6 @@ static int evt_remote_evt(void *msg, struct totem_ip_address *source_addr,
|
||||
|
||||
try_deliver_event(evt, eci);
|
||||
free_event_data(evt);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3213,8 +3192,7 @@ inline SaTimeT calc_retention_time(SaTimeT retention,
|
||||
/*
|
||||
* Receive a recovery network event message and save it in the retained list
|
||||
*/
|
||||
static int evt_remote_recovery_evt(void *msg, struct totem_ip_address *source_addr,
|
||||
int endian_conversion_required)
|
||||
static void evt_remote_recovery_evt(void *msg, struct totem_ip_address *source_addr)
|
||||
{
|
||||
/*
|
||||
* - calculate remaining retention time
|
||||
@ -3239,11 +3217,7 @@ static int evt_remote_recovery_evt(void *msg, struct totem_ip_address *source_ad
|
||||
if (recovery_phase == evt_recovery_complete) {
|
||||
log_printf(RECOVERY_EVENT_DEBUG,
|
||||
"Received recovery data, not in recovery mode\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (endian_conversion_required) {
|
||||
convert_event(evtpkt);
|
||||
return;
|
||||
}
|
||||
|
||||
log_printf(RECOVERY_EVENT_DEBUG,
|
||||
@ -3284,8 +3258,7 @@ static int evt_remote_recovery_evt(void *msg, struct totem_ip_address *source_ad
|
||||
*/
|
||||
log_printf(LOG_LEVEL_NOTICE, "No node for %s\n",
|
||||
totemip_print(&evtpkt->led_addr));
|
||||
errno = ENXIO;
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
log_printf(LOG_LEVEL_DEBUG, "Cluster node ID 0x%x name %s\n",
|
||||
md->mn_node_info.nodeId,
|
||||
@ -3303,7 +3276,7 @@ static int evt_remote_recovery_evt(void *msg, struct totem_ip_address *source_ad
|
||||
if (!eci) {
|
||||
log_printf(RECOVERY_EVENT_DEBUG, "Channel %s doesn't exist\n",
|
||||
evtpkt->led_chan_name.value);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
evt = make_local_event(evtpkt, eci);
|
||||
@ -3311,7 +3284,7 @@ static int evt_remote_recovery_evt(void *msg, struct totem_ip_address *source_ad
|
||||
log_printf(LOG_LEVEL_WARNING,
|
||||
"2Memory allocation error, can't deliver event\n");
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
retain_event(evt);
|
||||
@ -3320,8 +3293,6 @@ static int evt_remote_recovery_evt(void *msg, struct totem_ip_address *source_ad
|
||||
num_delivered);
|
||||
free_event_data(evt);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -3497,8 +3468,10 @@ static void evt_ret_time_clr_finish(struct retention_time_clear_pending *rtc,
|
||||
* our architectures word order.
|
||||
*/
|
||||
static void
|
||||
convert_chan_packet(struct req_evt_chan_command *cpkt)
|
||||
convert_chan_packet(void *msg)
|
||||
{
|
||||
struct req_evt_chan_command *cpkt = (struct req_evt_chan_command *)msg;
|
||||
|
||||
/*
|
||||
* converted in the main deliver_fn:
|
||||
* led_head.id, led_head.size.
|
||||
@ -3563,8 +3536,7 @@ convert_chan_packet(struct req_evt_chan_command *cpkt)
|
||||
* Used to communicate channel opens/closes, clear retention time,
|
||||
* config change updates...
|
||||
*/
|
||||
static int evt_remote_chan_op(void *msg, struct totem_ip_address *source_addr,
|
||||
int endian_conversion_required)
|
||||
static void evt_remote_chan_op(void *msg, struct totem_ip_address *source_addr)
|
||||
{
|
||||
struct req_evt_chan_command *cpkt = msg;
|
||||
unsigned int local_node = {SA_CLM_LOCAL_NODE_ID};
|
||||
@ -3572,10 +3544,6 @@ static int evt_remote_chan_op(void *msg, struct totem_ip_address *source_addr,
|
||||
struct member_node_data *mn;
|
||||
struct event_svr_channel_instance *eci;
|
||||
|
||||
if (endian_conversion_required) {
|
||||
convert_chan_packet(cpkt);
|
||||
}
|
||||
|
||||
log_printf(REMOTE_OP_DEBUG, "Remote channel operation request\n");
|
||||
my_node = main_clm_get_by_nodeid(local_node);
|
||||
log_printf(REMOTE_OP_DEBUG, "my node ID: 0x%x\n", my_node->nodeId);
|
||||
@ -3587,7 +3555,7 @@ static int evt_remote_chan_op(void *msg, struct totem_ip_address *source_addr,
|
||||
log_printf(LOG_LEVEL_WARNING,
|
||||
"Evt remote channel op: Node data for addr %s is NULL\n",
|
||||
totemip_print(source_addr));
|
||||
return 0;
|
||||
return;
|
||||
} else {
|
||||
evt_add_node(source_addr, cn);
|
||||
mn = evt_find_node(source_addr);
|
||||
@ -3905,8 +3873,6 @@ static int evt_remote_chan_op(void *msg, struct totem_ip_address *source_addr,
|
||||
cpkt->chc_op);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -36,8 +36,9 @@
|
||||
#include "../include/hdb.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/saEvt.h"
|
||||
#include "handlers.h"
|
||||
|
||||
extern struct service_handler evt_service_handler;
|
||||
extern struct openais_service_handler evt_service_handler;
|
||||
|
||||
/*
|
||||
* event instance structure. Contains information about the
|
||||
|
@ -31,56 +31,61 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef HANDLERS_H_DEFINED
|
||||
#define HANDLERS_H_DEFINED
|
||||
#ifndef OPENAIS_HANDLERS_H_DEFINED
|
||||
#define OPENAIS_HANDLERS_H_DEFINED
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include "main.h"
|
||||
#include "totempg.h"
|
||||
#include "totemsrp.h"
|
||||
#include "mainconfig.h" /* openais_config */
|
||||
#include "main.h" /* conn_info */
|
||||
#include "totemip.h"
|
||||
|
||||
#define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) )
|
||||
|
||||
enum flow_control {
|
||||
FLOW_CONTROL_REQUIRED = 1,
|
||||
FLOW_CONTROL_NOT_REQUIRED = 2
|
||||
// TODO we need to abstract the conn_info data structure to make dynamic loading work perfectly
|
||||
|
||||
enum openais_flow_control {
|
||||
OPENAIS_FLOW_CONTROL_REQUIRED = 1,
|
||||
OPENAIS_FLOW_CONTROL_NOT_REQUIRED = 2
|
||||
};
|
||||
|
||||
struct libais_handler {
|
||||
int (*libais_handler_fn) (struct conn_info *conn_info, void *msg);
|
||||
struct openais_lib_handler {
|
||||
void (*lib_handler_fn) (struct conn_info *conn_info, void *msg);
|
||||
int response_size;
|
||||
int response_id;
|
||||
enum flow_control flow_control;
|
||||
enum openais_flow_control flow_control;
|
||||
};
|
||||
|
||||
struct service_handler {
|
||||
struct openais_exec_handler {
|
||||
void (*exec_handler_fn) (void *msg, struct totem_ip_address *source_addr);
|
||||
void (*exec_endian_convert_fn) (void *msg);
|
||||
};
|
||||
|
||||
struct openais_service_handler {
|
||||
unsigned char *name;
|
||||
unsigned short id;
|
||||
struct libais_handler *libais_handlers;
|
||||
int libais_handlers_count;
|
||||
int (**aisexec_handler_fns) (void *msg, struct totem_ip_address *source_addr, int endian_conversion_needed);
|
||||
int aisexec_handler_fns_count;
|
||||
int (*confchg_fn) (
|
||||
int (*lib_init_fn) (struct conn_info *conn_info);
|
||||
int (*lib_exit_fn) (struct conn_info *conn_info);
|
||||
struct openais_lib_handler *lib_handlers;
|
||||
int lib_handlers_count;
|
||||
struct openais_exec_handler *exec_handlers;
|
||||
int (*exec_init_fn) (struct openais_config *);
|
||||
void (*exec_dump_fn) (void);
|
||||
int exec_handlers_count;
|
||||
void (*confchg_fn) (
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
struct totem_ip_address *joined_list, int joined_list_entries,
|
||||
struct memb_ring_id *ring_id);
|
||||
int (*libais_init_fn) (struct conn_info *conn_info, void *msg);
|
||||
int (*libais_init_two_fn) (struct conn_info *conn_info);
|
||||
int (*libais_exit_fn) (struct conn_info *conn_info);
|
||||
int (*exec_init_fn) (struct openais_config *);
|
||||
void (*exec_dump_fn) (void);
|
||||
|
||||
void (*sync_init) (void);
|
||||
int (*sync_process) (void);
|
||||
void (*sync_activate) (void);
|
||||
void (*sync_abort) (void);
|
||||
};
|
||||
|
||||
struct aisexec_iface_ver0 {
|
||||
struct openais_service_handler_iface_ver0 {
|
||||
void (*test) (void);
|
||||
struct service_handler *(*get_handler_ver0) (void);
|
||||
struct openais_service_handler *(*openais_get_service_handler_ver0) (void);
|
||||
};
|
||||
|
||||
#endif /* HANDLERS_H_DEFINED */
|
||||
|
288
exec/lck.c
288
exec/lck.c
@ -110,77 +110,72 @@ DECLARE_LIST_INIT(resource_list_head);
|
||||
|
||||
static int lck_exec_init_fn (struct openais_config *);
|
||||
|
||||
static int lck_exit_fn (struct conn_info *conn_info);
|
||||
static int lck_lib_exit_fn (struct conn_info *conn_info);
|
||||
|
||||
static int lck_init_two_fn (struct conn_info *conn_info);
|
||||
static int lck_lib_init_fn (struct conn_info *conn_info);
|
||||
|
||||
static int message_handler_req_exec_lck_resourceopen (
|
||||
static void message_handler_req_exec_lck_resourceopen (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required);
|
||||
struct totem_ip_address *source_addr);
|
||||
|
||||
static int message_handler_req_exec_lck_resourceclose (
|
||||
static void message_handler_req_exec_lck_resourceclose (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required);
|
||||
struct totem_ip_address *source_addr);
|
||||
|
||||
static int message_handler_req_exec_lck_resourcelock (
|
||||
static void message_handler_req_exec_lck_resourcelock (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required);
|
||||
struct totem_ip_address *source_addr);
|
||||
|
||||
static int message_handler_req_exec_lck_resourceunlock (
|
||||
static void message_handler_req_exec_lck_resourceunlock (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required);
|
||||
struct totem_ip_address *source_addr);
|
||||
|
||||
static int message_handler_req_exec_lck_resourcelockorphan (
|
||||
static void message_handler_req_exec_lck_resourcelockorphan (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required);
|
||||
struct totem_ip_address *source_addr);
|
||||
|
||||
static int message_handler_req_exec_lck_lockpurge (
|
||||
static void message_handler_req_exec_lck_lockpurge (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required);
|
||||
struct totem_ip_address *source_addr);
|
||||
|
||||
static int message_handler_req_lib_lck_resourceopen (
|
||||
static void message_handler_req_lib_lck_resourceopen (
|
||||
struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int message_handler_req_lib_lck_resourceopenasync (
|
||||
static void message_handler_req_lib_lck_resourceopenasync (
|
||||
struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int message_handler_req_lib_lck_resourceclose (
|
||||
static void message_handler_req_lib_lck_resourceclose (
|
||||
struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int message_handler_req_lib_lck_resourcelock (
|
||||
static void message_handler_req_lib_lck_resourcelock (
|
||||
struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int message_handler_req_lib_lck_resourcelockasync (
|
||||
static void message_handler_req_lib_lck_resourcelockasync (
|
||||
struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int message_handler_req_lib_lck_resourceunlock (
|
||||
static void message_handler_req_lib_lck_resourceunlock (
|
||||
struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int message_handler_req_lib_lck_resourceunlockasync (
|
||||
static void message_handler_req_lib_lck_resourceunlockasync (
|
||||
struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static int message_handler_req_lib_lck_lockpurge (
|
||||
static void message_handler_req_lib_lck_lockpurge (
|
||||
struct conn_info *conn_info,
|
||||
void *message);
|
||||
|
||||
static void lck_recovery_activate (void);
|
||||
static void lck_recovery_initialize (void);
|
||||
static int lck_recovery_process (void);
|
||||
static void lck_recovery_finalize();
|
||||
static void lck_recovery_abort(void);
|
||||
#ifdef TODO
|
||||
static void lck_sync_init (void);
|
||||
#endif
|
||||
static int lck_sync_process (void);
|
||||
static void lck_sync_activate (void);
|
||||
static void lck_sync_abort (void);
|
||||
|
||||
void resource_release (struct resource *resource);
|
||||
|
||||
@ -190,125 +185,140 @@ static struct list_head *recovery_lck_section_next = 0;
|
||||
static int recovery_section_data_offset = 0;
|
||||
static int recovery_section_send_flag = 0;
|
||||
static int recovery_abort = 0;
|
||||
//static struct memb_ring_id saved_ring_id;
|
||||
*/
|
||||
|
||||
static struct memb_ring_id saved_ring_id;
|
||||
|
||||
static int lck_confchg_fn (
|
||||
static void lck_confchg_fn (
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct in_addr *member_list, int member_list_entries,
|
||||
struct in_addr *left_list, int left_list_entries,
|
||||
struct in_addr *joined_list, int joined_list_entries,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
struct totem_ip_address *joined_list, int joined_list_entries,
|
||||
struct memb_ring_id *ring_id);
|
||||
|
||||
/*
|
||||
* Executive Handler Definition
|
||||
*/
|
||||
struct libais_handler lck_libais_handlers[] =
|
||||
static struct openais_lib_handler lck_lib_handlers[] =
|
||||
{
|
||||
{ /* 0 */
|
||||
.libais_handler_fn = message_handler_req_lib_lck_resourceopen,
|
||||
.lib_handler_fn = message_handler_req_lib_lck_resourceopen,
|
||||
.response_size = sizeof (struct res_lib_lck_resourceopen),
|
||||
.response_id = MESSAGE_RES_LCK_RESOURCEOPEN,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 1 */
|
||||
.libais_handler_fn = message_handler_req_lib_lck_resourceopenasync,
|
||||
.lib_handler_fn = message_handler_req_lib_lck_resourceopenasync,
|
||||
.response_size = sizeof (struct res_lib_lck_resourceopenasync),
|
||||
.response_id = MESSAGE_RES_LCK_RESOURCEOPENASYNC,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 2 */
|
||||
.libais_handler_fn = message_handler_req_lib_lck_resourceclose,
|
||||
.lib_handler_fn = message_handler_req_lib_lck_resourceclose,
|
||||
.response_size = sizeof (struct res_lib_lck_resourceclose),
|
||||
.response_id = MESSAGE_RES_LCK_RESOURCECLOSE,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 3 */
|
||||
.libais_handler_fn = message_handler_req_lib_lck_resourcelock,
|
||||
.lib_handler_fn = message_handler_req_lib_lck_resourcelock,
|
||||
.response_size = sizeof (struct res_lib_lck_resourcelock),
|
||||
.response_id = MESSAGE_RES_LCK_RESOURCELOCK,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 4 */
|
||||
.libais_handler_fn = message_handler_req_lib_lck_resourcelockasync,
|
||||
.lib_handler_fn = message_handler_req_lib_lck_resourcelockasync,
|
||||
.response_size = sizeof (struct res_lib_lck_resourcelockasync),
|
||||
.response_id = MESSAGE_RES_LCK_RESOURCELOCKASYNC,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 5 */
|
||||
.libais_handler_fn = message_handler_req_lib_lck_resourceunlock,
|
||||
.lib_handler_fn = message_handler_req_lib_lck_resourceunlock,
|
||||
.response_size = sizeof (struct res_lib_lck_resourceunlock),
|
||||
.response_id = MESSAGE_RES_LCK_RESOURCELOCK,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 6 */
|
||||
.libais_handler_fn = message_handler_req_lib_lck_resourceunlockasync,
|
||||
.lib_handler_fn = message_handler_req_lib_lck_resourceunlockasync,
|
||||
.response_size = sizeof (struct res_lib_lck_resourceunlock),
|
||||
.response_id = MESSAGE_RES_LCK_RESOURCEUNLOCKASYNC,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
},
|
||||
{ /* 7 */
|
||||
.libais_handler_fn = message_handler_req_lib_lck_lockpurge,
|
||||
.lib_handler_fn = message_handler_req_lib_lck_lockpurge,
|
||||
.response_size = sizeof (struct res_lib_lck_lockpurge),
|
||||
.response_id = MESSAGE_RES_LCK_LOCKPURGE,
|
||||
.flow_control = FLOW_CONTROL_REQUIRED
|
||||
.flow_control = OPENAIS_FLOW_CONTROL_REQUIRED
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static int (*lck_aisexec_handler_fns[]) (void *msg, struct in_addr source_addr, int endian_conversion_required) = {
|
||||
message_handler_req_exec_lck_resourceopen,
|
||||
message_handler_req_exec_lck_resourceclose,
|
||||
message_handler_req_exec_lck_resourcelock,
|
||||
message_handler_req_exec_lck_resourceunlock,
|
||||
message_handler_req_exec_lck_resourcelockorphan,
|
||||
message_handler_req_exec_lck_lockpurge,
|
||||
static struct openais_exec_handler lck_exec_handlers[] = {
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_lck_resourceopen,
|
||||
},
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_lck_resourceclose,
|
||||
},
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_lck_resourcelock,
|
||||
},
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_lck_resourceunlock,
|
||||
},
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_lck_resourcelockorphan,
|
||||
},
|
||||
{
|
||||
.exec_handler_fn = message_handler_req_exec_lck_lockpurge,
|
||||
}
|
||||
};
|
||||
|
||||
struct service_handler lck_service_handler = {
|
||||
.name = "openais distributed locking service B.01.01",
|
||||
struct openais_service_handler lck_service_handler = {
|
||||
.name = (unsigned char*)"openais distributed locking service B.01.01",
|
||||
.id = LCK_SERVICE,
|
||||
.libais_handlers = lck_libais_handlers,
|
||||
.libais_handlers_count = sizeof (lck_libais_handlers) / sizeof (struct libais_handler),
|
||||
.aisexec_handler_fns = lck_aisexec_handler_fns,
|
||||
.aisexec_handler_fns_count = sizeof (lck_aisexec_handler_fns) / sizeof (int (*)),
|
||||
.confchg_fn = lck_confchg_fn,
|
||||
.libais_init_two_fn = lck_init_two_fn,
|
||||
.libais_exit_fn = lck_exit_fn,
|
||||
.lib_init_fn = lck_lib_init_fn,
|
||||
.lib_exit_fn = lck_lib_exit_fn,
|
||||
.lib_handlers = lck_lib_handlers,
|
||||
.lib_handlers_count = sizeof (lck_lib_handlers) / sizeof (struct openais_lib_handler),
|
||||
.exec_init_fn = lck_exec_init_fn,
|
||||
.exec_handlers = lck_exec_handlers,
|
||||
.exec_handlers_count = sizeof (lck_exec_handlers) / sizeof (struct openais_exec_handler),
|
||||
.exec_dump_fn = NULL,
|
||||
.sync_init = NULL, // TODO lck_recovery_initialize,
|
||||
.sync_process = lck_recovery_process,
|
||||
.sync_activate = lck_recovery_activate,
|
||||
.sync_abort = lck_recovery_abort,
|
||||
.confchg_fn = lck_confchg_fn,
|
||||
.sync_init = NULL,
|
||||
// .sync_init = lck_sync_init,
|
||||
.sync_process = lck_sync_process,
|
||||
.sync_activate = lck_sync_activate,
|
||||
.sync_abort = lck_sync_abort,
|
||||
};
|
||||
|
||||
/*
|
||||
* Dynamic loader definition
|
||||
*/
|
||||
#ifdef BUILD_DYNAMIC
|
||||
|
||||
struct service_handler *lck_get_handler_ver0 (void);
|
||||
struct openais_service_handler *lck_get_handler_ver0 (void);
|
||||
|
||||
struct aisexec_iface_ver0 lck_service_handler_iface = {
|
||||
.test = NULL,
|
||||
.get_handler_ver0 = lck_get_handler_ver0
|
||||
struct openais_service_handler_iface_ver0 lck_service_handler_iface = {
|
||||
.openais_get_service_handler_ver0 = lck_get_handler_ver0
|
||||
};
|
||||
|
||||
struct lcr_iface openais_lck_ver0[1] = {
|
||||
{
|
||||
.name = "openais_lck",
|
||||
.version = 0,
|
||||
.name = "openais_lck",
|
||||
.version = 0,
|
||||
.versions_replace = 0,
|
||||
.versions_replace_count = 0,
|
||||
.versions_replace_count = 0,
|
||||
.dependencies = 0,
|
||||
.dependency_count = 0,
|
||||
.constructor = NULL,
|
||||
.destructor = NULL,
|
||||
.interfaces = (void **)&lck_service_handler_iface,
|
||||
.destructor = NULL,
|
||||
.interfaces = (void **)&lck_service_handler_iface,
|
||||
}
|
||||
};
|
||||
|
||||
struct lcr_comp lck_comp_ver0 = {
|
||||
.iface_count = 1,
|
||||
.iface_count = 1,
|
||||
.ifaces = openais_lck_ver0
|
||||
};
|
||||
|
||||
@ -318,7 +328,7 @@ extern int lcr_comp_get (struct lcr_comp **component)
|
||||
return (0);
|
||||
}
|
||||
|
||||
struct service_handler *lck_get_handler_ver0 (void)
|
||||
struct openais_service_handler *lck_get_handler_ver0 (void)
|
||||
{
|
||||
return (&lck_service_handler);
|
||||
}
|
||||
@ -379,40 +389,35 @@ struct req_exec_lck_lockpurge {
|
||||
struct req_lib_lck_lockpurge req_lib_lck_lockpurge;
|
||||
};
|
||||
|
||||
static void lck_recovery_initialize (void)
|
||||
#ifdef TODO
|
||||
static void lck_sync_init (void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int lck_recovery_process (void)
|
||||
static int lck_sync_process (void)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void lck_recovery_finalize ()
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
static void lck_recovery_activate (void)
|
||||
static void lck_sync_activate (void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static void lck_recovery_abort (void)
|
||||
static void lck_sync_abort (void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static int lck_confchg_fn (
|
||||
static void lck_confchg_fn (
|
||||
enum totem_configuration_type configuration_type,
|
||||
struct in_addr *member_list, int member_list_entries,
|
||||
struct in_addr *left_list, int left_list_entries,
|
||||
struct in_addr *joined_list, int joined_list_entries,
|
||||
struct totem_ip_address *member_list, int member_list_entries,
|
||||
struct totem_ip_address *left_list, int left_list_entries,
|
||||
struct totem_ip_address *joined_list, int joined_list_entries,
|
||||
struct memb_ring_id *ring_id)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static struct resource *resource_find (SaNameT *name)
|
||||
@ -573,15 +578,10 @@ static int lck_exec_init_fn (struct openais_config *openais_config)
|
||||
/*
|
||||
* Initialize the saved ring ID.
|
||||
*/
|
||||
#ifdef TODO
|
||||
saved_ring_id.seq = 0;
|
||||
saved_ring_id.rep.s_addr = this_ip->sin_addr.s_addr;
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int lck_exit_fn (struct conn_info *conn_info)
|
||||
static int lck_lib_exit_fn (struct conn_info *conn_info)
|
||||
{
|
||||
struct resource_cleanup *resource_cleanup;
|
||||
struct list_head *list;
|
||||
@ -614,26 +614,24 @@ static int lck_exit_fn (struct conn_info *conn_info)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int lck_init_two_fn (struct conn_info *conn_info)
|
||||
static int lck_lib_init_fn (struct conn_info *conn_info)
|
||||
{
|
||||
list_init (&conn_info->conn_info_partner->ais_ci.u.liblck_ci.resource_list);
|
||||
list_init (&conn_info->conn_info_partner->ais_ci.u.liblck_ci.resource_cleanup_list);
|
||||
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_lck_resourceopen (
|
||||
static void message_handler_req_exec_lck_resourceopen (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required)
|
||||
struct totem_ip_address *source_addr)
|
||||
{
|
||||
struct req_exec_lck_resourceopen *req_exec_lck_resourceopen = (struct req_exec_lck_resourceopen *)message;
|
||||
struct res_lib_lck_resourceopen res_lib_lck_resourceopen;
|
||||
struct res_lib_lck_resourceopenasync res_lib_lck_resourceopenasync;
|
||||
struct resource *resource;
|
||||
struct resource_cleanup *resource_cleanup;
|
||||
SaErrorT error = SA_AIS_OK;
|
||||
SaAisErrorT error = SA_AIS_OK;
|
||||
|
||||
log_printf (LOG_LEVEL_NOTICE, "EXEC request: saLckResourceOpen %s\n",
|
||||
getSaNameT (&req_exec_lck_resourceopen->resource_name));
|
||||
@ -739,14 +737,11 @@ error_exit:
|
||||
sizeof (struct res_lib_lck_resourceopen));
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_lck_resourceclose (
|
||||
static void message_handler_req_exec_lck_resourceclose (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required)
|
||||
struct totem_ip_address *source_addr)
|
||||
{
|
||||
struct req_exec_lck_resourceclose *req_exec_lck_resourceclose = (struct req_exec_lck_resourceclose *)message;
|
||||
struct res_lib_lck_resourceclose res_lib_lck_resourceclose;
|
||||
@ -776,7 +771,6 @@ error_exit:
|
||||
libais_send_response (req_exec_lck_resourceclose->source.conn_info,
|
||||
&res_lib_lck_resourceclose, sizeof (struct res_lib_lck_resourceclose));
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
void waiter_notification_send (struct resource_lock *resource_lock)
|
||||
@ -1033,10 +1027,9 @@ void unlock_algorithm (
|
||||
}
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_lck_resourcelock (
|
||||
static void message_handler_req_exec_lck_resourcelock (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required)
|
||||
struct totem_ip_address *source_addr)
|
||||
{
|
||||
struct req_exec_lck_resourcelock *req_exec_lck_resourcelock = (struct req_exec_lck_resourcelock *)message;
|
||||
struct resource *resource = 0;
|
||||
@ -1142,13 +1135,12 @@ static int message_handler_req_exec_lck_resourcelock (
|
||||
}
|
||||
|
||||
error_exit:
|
||||
return (0);
|
||||
return;
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_lck_resourceunlock (
|
||||
static void message_handler_req_exec_lck_resourceunlock (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required)
|
||||
struct totem_ip_address *source_addr)
|
||||
{
|
||||
struct req_exec_lck_resourceunlock *req_exec_lck_resourceunlock = (struct req_exec_lck_resourceunlock *)message;
|
||||
struct res_lib_lck_resourceunlock res_lib_lck_resourceunlock;
|
||||
@ -1199,13 +1191,11 @@ error_exit:
|
||||
&res_lib_lck_resourceunlock, sizeof (struct res_lib_lck_resourceunlock));
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_lck_resourcelockorphan (
|
||||
static void message_handler_req_exec_lck_resourcelockorphan (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required)
|
||||
struct totem_ip_address *source_addr)
|
||||
{
|
||||
struct req_exec_lck_resourcelockorphan *req_exec_lck_resourcelockorphan = (struct req_exec_lck_resourcelockorphan *)message;
|
||||
struct resource *resource = 0;
|
||||
@ -1227,13 +1217,11 @@ static int message_handler_req_exec_lck_resourcelockorphan (
|
||||
|
||||
list_del (&resource_lock->resource_cleanup_list);
|
||||
unlock_algorithm (resource, resource_lock);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_exec_lck_lockpurge (
|
||||
static void message_handler_req_exec_lck_lockpurge (
|
||||
void *message,
|
||||
struct in_addr source_addr,
|
||||
int endian_conversion_required)
|
||||
struct totem_ip_address *source_addr)
|
||||
{
|
||||
struct req_exec_lck_lockpurge *req_exec_lck_lockpurge = (struct req_exec_lck_lockpurge *)message;
|
||||
struct res_lib_lck_lockpurge res_lib_lck_lockpurge;
|
||||
@ -1259,10 +1247,9 @@ error_exit:
|
||||
libais_send_response (req_exec_lck_lockpurge->source.conn_info,
|
||||
&res_lib_lck_lockpurge, sizeof (struct res_lib_lck_lockpurge));
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_lck_resourceopen (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_lck_resourceopen (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_lck_resourceopen *req_lib_lck_resourceopen = (struct req_lib_lck_resourceopen *)message;
|
||||
struct req_exec_lck_resourceopen req_exec_lck_resourceopen;
|
||||
@ -1292,11 +1279,9 @@ static int message_handler_req_lib_lck_resourceopen (struct conn_info *conn_info
|
||||
iovec.iov_len = sizeof (req_exec_lck_resourceopen);
|
||||
|
||||
assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED) == 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_lck_resourceopenasync (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_lck_resourceopenasync (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_lck_resourceopen *req_lib_lck_resourceopen = (struct req_lib_lck_resourceopen *)message;
|
||||
struct req_exec_lck_resourceopen req_exec_lck_resourceopen;
|
||||
@ -1326,11 +1311,9 @@ static int message_handler_req_lib_lck_resourceopenasync (struct conn_info *conn
|
||||
iovec.iov_len = sizeof (req_exec_lck_resourceopen);
|
||||
|
||||
assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED) == 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_lck_resourceclose (struct conn_info *conn_info, void *message) {
|
||||
static void message_handler_req_lib_lck_resourceclose (struct conn_info *conn_info, void *message) {
|
||||
struct req_lib_lck_resourceclose *req_lib_lck_resourceclose = (struct req_lib_lck_resourceclose *)message;
|
||||
struct req_exec_lck_resourceclose req_exec_lck_resourceclose;
|
||||
struct iovec iovecs[2];
|
||||
@ -1371,10 +1354,9 @@ static int message_handler_req_lib_lck_resourceclose (struct conn_info *conn_inf
|
||||
&res_lib_lck_resourceclose,
|
||||
sizeof (struct res_lib_lck_resourceclose));
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_lck_resourcelock (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_lck_resourcelock (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_lck_resourcelock *req_lib_lck_resourcelock = (struct req_lib_lck_resourcelock *)message;
|
||||
struct req_exec_lck_resourcelock req_exec_lck_resourcelock;
|
||||
@ -1403,11 +1385,9 @@ static int message_handler_req_lib_lck_resourcelock (struct conn_info *conn_info
|
||||
iovecs[0].iov_len = sizeof (req_exec_lck_resourcelock);
|
||||
|
||||
assert (totempg_groups_mcast_joined (openais_group_handle, iovecs, 1, TOTEMPG_AGREED) == 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_lck_resourcelockasync (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_lck_resourcelockasync (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_lck_resourcelock *req_lib_lck_resourcelock = (struct req_lib_lck_resourcelock *)message;
|
||||
struct req_exec_lck_resourcelock req_exec_lck_resourcelock;
|
||||
@ -1435,11 +1415,9 @@ static int message_handler_req_lib_lck_resourcelockasync (struct conn_info *conn
|
||||
iovecs[0].iov_len = sizeof (req_exec_lck_resourcelock);
|
||||
|
||||
assert (totempg_groups_mcast_joined (openais_group_handle, iovecs, 1, TOTEMPG_AGREED) == 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_lck_resourceunlock (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_lck_resourceunlock (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_lck_resourceunlock *req_lib_lck_resourceunlock = (struct req_lib_lck_resourceunlock *)message;
|
||||
struct req_exec_lck_resourceunlock req_exec_lck_resourceunlock;
|
||||
@ -1467,11 +1445,9 @@ static int message_handler_req_lib_lck_resourceunlock (struct conn_info *conn_in
|
||||
iovec.iov_len = sizeof (req_exec_lck_resourceunlock);
|
||||
|
||||
assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED) == 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_lck_resourceunlockasync (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_lck_resourceunlockasync (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_lck_resourceunlock *req_lib_lck_resourceunlock = (struct req_lib_lck_resourceunlock *)message;
|
||||
struct req_exec_lck_resourceunlock req_exec_lck_resourceunlock;
|
||||
@ -1499,11 +1475,9 @@ static int message_handler_req_lib_lck_resourceunlockasync (struct conn_info *co
|
||||
iovec.iov_len = sizeof (req_exec_lck_resourceunlock);
|
||||
|
||||
assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED) == 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int message_handler_req_lib_lck_lockpurge (struct conn_info *conn_info, void *message)
|
||||
static void message_handler_req_lib_lck_lockpurge (struct conn_info *conn_info, void *message)
|
||||
{
|
||||
struct req_lib_lck_lockpurge *req_lib_lck_lockpurge = (struct req_lib_lck_lockpurge *)message;
|
||||
struct req_exec_lck_lockpurge req_exec_lck_lockpurge;
|
||||
@ -1527,7 +1501,5 @@ static int message_handler_req_lib_lck_lockpurge (struct conn_info *conn_info, v
|
||||
iovecs[0].iov_len = sizeof (req_exec_lck_lockpurge);
|
||||
|
||||
assert (totempg_groups_mcast_joined (openais_group_handle, iovecs, 1, TOTEMPG_AGREED) == 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,6 @@ struct liblck_ci {
|
||||
struct list_head resource_cleanup_list;
|
||||
};
|
||||
|
||||
extern struct service_handler lck_service_handler;
|
||||
extern struct openais_service_handler lck_service_handler;
|
||||
|
||||
#endif /* CKPT_H_DEFINED */
|
||||
|
58
exec/main.c
58
exec/main.c
@ -79,6 +79,7 @@
|
||||
#include "lck.h"
|
||||
#include "msg.h"
|
||||
#include "cfg.h"
|
||||
#include "ykd.h"
|
||||
#include "swab.h"
|
||||
|
||||
#define LOG_SERVICE LOG_SERVICE_MAIN
|
||||
@ -97,7 +98,7 @@ struct dynamic_service {
|
||||
char *name;
|
||||
unsigned int ver;
|
||||
unsigned int handle;
|
||||
struct aisexec_iface_ver0 *iface_ver0;
|
||||
struct openais_service_handler_iface_ver0 *iface_ver0;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -155,13 +156,7 @@ struct dynamic_service dynamic_services[128] = {
|
||||
};
|
||||
#endif /* BUILD_DYNAMIC */
|
||||
|
||||
static struct service_handler *ais_service_handlers[32];
|
||||
|
||||
/*
|
||||
unsigned int aisexec_ifact_handle_ver0[32];
|
||||
|
||||
static struct aisexec_iface_ver0 *aisexec_iface_ver0[32];
|
||||
*/
|
||||
static struct openais_service_handler *ais_service_handlers[32];
|
||||
|
||||
static unsigned int service_handlers_count = 32;
|
||||
|
||||
@ -280,16 +275,16 @@ static int libais_disconnect (struct conn_info *conn_info)
|
||||
struct outq_item *outq_item;
|
||||
|
||||
if (conn_info->should_exit_fn &&
|
||||
ais_service_handlers[conn_info->service]->libais_exit_fn) {
|
||||
ais_service_handlers[conn_info->service]->lib_exit_fn) {
|
||||
|
||||
res = ais_service_handlers[conn_info->service]->libais_exit_fn (conn_info);
|
||||
res = ais_service_handlers[conn_info->service]->lib_exit_fn (conn_info);
|
||||
}
|
||||
|
||||
if (conn_info->conn_info_partner &&
|
||||
conn_info->conn_info_partner->should_exit_fn &&
|
||||
ais_service_handlers[conn_info->conn_info_partner->service]->libais_exit_fn) {
|
||||
ais_service_handlers[conn_info->conn_info_partner->service]->lib_exit_fn) {
|
||||
|
||||
res = ais_service_handlers[conn_info->conn_info_partner->service]->libais_exit_fn (conn_info->conn_info_partner);
|
||||
res = ais_service_handlers[conn_info->conn_info_partner->service]->lib_exit_fn (conn_info->conn_info_partner);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -621,7 +616,7 @@ static int dispatch_init_send_response (struct conn_info *conn_info, void *messa
|
||||
}
|
||||
|
||||
conn_info->should_exit_fn = 1;
|
||||
ais_service_handlers[req_lib_dispatch_init->resdis_header.service]->libais_init_two_fn (conn_info);
|
||||
ais_service_handlers[req_lib_dispatch_init->resdis_header.service]->lib_init_fn (conn_info);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -770,9 +765,9 @@ retry_recv:
|
||||
/*
|
||||
* Not an init service, but a standard service
|
||||
*/
|
||||
if (header->id < 0 || header->id > ais_service_handlers[service]->libais_handlers_count) {
|
||||
if (header->id < 0 || header->id > ais_service_handlers[service]->lib_handlers_count) {
|
||||
log_printf (LOG_LEVEL_SECURITY, "Invalid header id is %d min 0 max %d\n",
|
||||
header->id, ais_service_handlers[service]->libais_handlers_count);
|
||||
header->id, ais_service_handlers[service]->lib_handlers_count);
|
||||
res = -1;
|
||||
goto error_disconnect;
|
||||
}
|
||||
@ -790,14 +785,14 @@ retry_recv:
|
||||
|
||||
send_ok =
|
||||
(ykd_primary() == 1) && (
|
||||
(ais_service_handlers[service]->libais_handlers[header->id].flow_control == FLOW_CONTROL_NOT_REQUIRED) ||
|
||||
((ais_service_handlers[service]->libais_handlers[header->id].flow_control == FLOW_CONTROL_REQUIRED) &&
|
||||
(ais_service_handlers[service]->lib_handlers[header->id].flow_control == OPENAIS_FLOW_CONTROL_NOT_REQUIRED) ||
|
||||
((ais_service_handlers[service]->lib_handlers[header->id].flow_control == OPENAIS_FLOW_CONTROL_REQUIRED) &&
|
||||
(send_ok_joined) &&
|
||||
(sync_in_process() == 0)));
|
||||
|
||||
if (send_ok) {
|
||||
// *prio = 0;
|
||||
res = ais_service_handlers[service]->libais_handlers[header->id].libais_handler_fn(conn_info, header);
|
||||
ais_service_handlers[service]->lib_handlers[header->id].lib_handler_fn(conn_info, header);
|
||||
} else {
|
||||
// *prio = (*prio) + 1;
|
||||
|
||||
@ -805,9 +800,9 @@ retry_recv:
|
||||
* Overload, tell library to retry
|
||||
*/
|
||||
res_overlay.header.size =
|
||||
ais_service_handlers[service]->libais_handlers[header->id].response_size;
|
||||
ais_service_handlers[service]->lib_handlers[header->id].response_size;
|
||||
res_overlay.header.id =
|
||||
ais_service_handlers[service]->libais_handlers[header->id].response_id;
|
||||
ais_service_handlers[service]->lib_handlers[header->id].response_id;
|
||||
res_overlay.header.error = SA_AIS_ERR_TRY_AGAIN;
|
||||
libais_send_response (conn_info, &res_overlay,
|
||||
res_overlay.header.size);
|
||||
@ -830,7 +825,7 @@ retry_recv:
|
||||
conn_info->inb_start = conn_info->inb_inuse;
|
||||
}
|
||||
|
||||
return (res);
|
||||
return (0);
|
||||
|
||||
error_disconnect:
|
||||
res = libais_disconnect (conn_info);
|
||||
@ -893,7 +888,6 @@ static void deliver_fn (
|
||||
int endian_conversion_required)
|
||||
{
|
||||
struct req_header *header;
|
||||
int res;
|
||||
int pos = 0;
|
||||
int i;
|
||||
int service;
|
||||
@ -926,8 +920,13 @@ static void deliver_fn (
|
||||
*/
|
||||
service = header->id >> 16;
|
||||
fn_id = header->id & 0xffff;
|
||||
res = ais_service_handlers[service]->aisexec_handler_fns[fn_id]
|
||||
(header, source_addr, endian_conversion_required);
|
||||
if (endian_conversion_required) {
|
||||
ais_service_handlers[service]->exec_handlers[fn_id].exec_endian_convert_fn
|
||||
(header);
|
||||
}
|
||||
|
||||
ais_service_handlers[service]->exec_handlers[fn_id].exec_handler_fn
|
||||
(header, source_addr);
|
||||
}
|
||||
|
||||
static struct memb_ring_id aisexec_ring_id;
|
||||
@ -1100,15 +1099,18 @@ void message_source_set (struct message_source *source, struct conn_info *conn_i
|
||||
struct totem_logging_configuration totem_logging_configuration;
|
||||
|
||||
int service_handler_register (
|
||||
struct service_handler *handler,
|
||||
struct openais_service_handler *handler,
|
||||
struct openais_config *config)
|
||||
{
|
||||
int res = 0;
|
||||
assert (ais_service_handlers[handler->id] == NULL);
|
||||
log_printf (LOG_LEVEL_NOTICE, "Registering service handler '%s'\n", handler->name);
|
||||
ais_service_handlers[handler->id] = handler;
|
||||
if (ais_service_handlers[handler->id]->exec_init_fn) {
|
||||
ais_service_handlers[handler->id]->exec_init_fn (config);
|
||||
res = ais_service_handlers[handler->id]->exec_init_fn (config);
|
||||
}
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
void default_services_register (struct openais_config *openais_config)
|
||||
@ -1124,7 +1126,9 @@ void default_services_register (struct openais_config *openais_config)
|
||||
(void **)&dynamic_services[i].iface_ver0,
|
||||
(void *)0);
|
||||
|
||||
service_handler_register (dynamic_services[i].iface_ver0->get_handler_ver0(), openais_config);
|
||||
service_handler_register (
|
||||
dynamic_services[i].iface_ver0->openais_get_service_handler_ver0(),
|
||||
openais_config);
|
||||
}
|
||||
|
||||
#else /* NOT BUILD_DYNAMIC */
|
||||
|
515
exec/msg.c
515
exec/msg.c
File diff suppressed because it is too large
Load Diff
@ -44,6 +44,6 @@ struct libmsg_ci {
|
||||
struct list_head queue_cleanup_list;
|
||||
};
|
||||
|
||||
extern struct service_handler msg_service_handler;
|
||||
extern struct openais_service_handler msg_service_handler;
|
||||
|
||||
#endif /* MSG_H_DEFINED */
|
||||
|
Loading…
Reference in New Issue
Block a user