Fellow Developers,
I have started work on cleaning up some of the interfaces available for
plugin developers and renaming some of the apis for brevity and clarity.
The first part of this header is the stuff that is used within a plugin
and is pretty much a cut and paste job from openais/exec/service.h. The
other part is the corosync_api_v1 which is the public API that will be
exported to service handlers.
If you have questions about the API or suggestions for things that may
be missing that should be added, please make them now. Keep in mind
every service handler uses all of these apis so they are a "minimum set"
of functions that should be made available to plugin developers.
Regards
-steve
/*
* Copyright (c) 2008 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Steven Dake ([EMAIL PROTECTED])
*
* This software licensed under BSD license, the text of which follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the MontaVista Software, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef COROAPI_H_DEFINED
#define COROAPI_H_DEFINED
#define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) )
#define SERVICE_HANDLER_MAXIMUM_COUNT 64
enum corosync_flow_control {
COROSYNC_FLOW_CONTROL_REQUIRED = 1,
COROSYNC_FLOW_CONTROL_NOT_REQUIRED = 2
};
struct corosync_lib_handler {
void (*lib_handler_fn) (void *conn, void *msg);
int response_size;
int response_id;
enum corosync_flow_control flow_control;
};
struct corosync_exec_handler {
void (*exec_handler_fn) (void *msg, unsigned int nodeid);
void (*exec_endian_convert_fn) (void *msg);
};
struct corosync_service_handler {
char *name;
unsigned short id;
unsigned int private_data_size;
enum corosync_flow_control flow_control;
int (*lib_init_fn) (void *conn);
int (*lib_exit_fn) (void *conn);
struct corosync_lib_handler *lib_service;
int lib_service_count;
struct corosync_exec_handler *exec_service;
int (*exec_init_fn) (struct objdb_iface_ver0 *);
int (*config_init_fn) (struct objdb_iface_ver0 *);
void (*exec_dump_fn) (void);
int exec_service_count;
void (*confchg_fn) (
enum totem_configuration_type configuration_type,
unsigned int *member_list, int member_list_entries,
unsigned int *left_list, int left_list_entries,
unsigned int *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id);
void (*sync_init) (void);
int (*sync_process) (void);
void (*sync_activate) (void);
void (*sync_abort) (void);
};
struct corosync_service_handler_iface_ver0 {
void (*test) (void);
struct corosync_service_handler *(*corosync_get_service_handler_ver0) (void);
};
extern int corosync_service_objdb_add (
struct objdb_iface_ver0 *objdb,
char *name,
int version);
extern int corosync_service_handler_register (
struct corosync_service_handler *handler);
extern int corosync_service_default_objdb_set (struct objdb_iface_ver0 *objdb);
extern int corosync_service_link_all (
struct objdb_iface_ver0 *objdb);
extern int corosync_service_init_all (
int service_count,
struct objdb_iface_ver0 *objdb);
extern struct corosync_service_handler *ais_service[];
typedef void *corosync_timer_handle;
struct corosync_api_v1 {
int (*timer_add_duration) (
unsigned long long nanoseconds_in_future,
void *data,
void (*timer_nf) (void *data),
corosync_timer_api_handle *handle);
int (*timer_add_absolute) (
unsigned long long nanoseconds_from_epoch,
void *data,
void (*timer_fn) (void *data),
corosync_timer_handle *handle)
void (*timer_delete) (
timer_handle timer_handle):
unsigned long long (*timer_time_get) (void);
void (*timer_delete) (corosync_timer_handle timer_handle);
void (*ipc_source_set) (mar_message_source_t *source, void *conn);
int (*ipc_source_is_local) (mar_message_source_t *source);
void *(*ipc_private_data_get) (void *conn);
int (*ipc_response_send) (void *conn, void *msg, int mlen);
int (*ipc_dispatch_send) (void *conn, void *msg, int mlen);
void (*ipc_refcnt_inc) (void *conn);
void (*ipc_refcnt_dec) (void *conn);
void (*ipc_fc_create) (
void *conn,
unsigned int service,
char *id,
int id_len,
void (*flow_control_state_set_fn)
(void *context,
enum corosync_flow_control_state flow_control_state_set),
void *context);
void (*ipc_fc_destroy) (
void *conn,
unsigned int service,
unsigned char *id,
int id_len);
void (*ipc_fc_inc) (void *conn);
void (*ipc_fc_dec) (void *conn);
unsigned int (*totem_nodeid_get) (void);
unsigned int (*totem_ring_reenable) (void);
unsigned int (*totem_mcast) (struct iovec *iovec, int iov_len, unsigned int gaurantee);
unsigned void (*error_memory_failure) (void);
}
#endif /* COROAPI_H_DEFINED */
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais