mirror_corosync/include/evs.h
Steven Dake 953a21eab8 commit for redundant ring take 4 was only done from exec directory missing all
of the commits for the rest of the directories.  This commit will now allow the
tree to compile.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1035 fd59a12c-fef9-0310-b244-a6a79926bd2f
2006-05-21 23:11:42 +00:00

191 lines
5.0 KiB
C

/*
* Copyright (c) 2004 MontaVista Software, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@mvista.com)
*
* 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 OPENAIS_EVS_H_DEFINED
#define OPENAIS_EVS_H_DEFINED
#include <sys/types.h>
#include <netinet/in.h>
/**
* @defgroup openais Other API services provided by openais
*/
/**
* @addtogroup evs_openais
*
* @{
*/
typedef u_int64_t evs_handle_t;
typedef enum {
EVS_DISPATCH_ONE,
EVS_DISPATCH_ALL,
EVS_DISPATCH_BLOCKING
} evs_dispatch_t;
typedef enum {
EVS_TYPE_UNORDERED, /* not implemented */
EVS_TYPE_FIFO, /* same as agreed */
EVS_TYPE_AGREED,
EVS_TYPE_SAFE /* not implemented */
} evs_guarantee_t;
typedef enum {
EVS_OK = 1,
EVS_ERR_LIBRARY = 2,
EVS_ERR_TIMEOUT = 5,
EVS_ERR_TRY_AGAIN = 6,
EVS_ERR_INVALID_PARAM = 7,
EVS_ERR_NO_MEMORY = 8,
EVS_ERR_BAD_HANDLE = 9,
EVS_ERR_ACCESS = 11,
EVS_ERR_NOT_EXIST = 12,
EVS_ERR_EXIST = 14,
EVS_ERR_NOT_SUPPORTED = 20,
EVS_ERR_SECURITY = 29,
EVS_ERR_TOO_MANY_GROUPS=30
} evs_error_t;
#define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
/** These are the things that get passed around */
struct evs_address {
unsigned int nodeid;
unsigned short family;
unsigned char addr[TOTEMIP_ADDRLEN];
};
struct evs_group {
char key[32];
};
typedef void (*evs_deliver_fn_t) (
unsigned int nodeid,
void *msg,
int msg_len);
typedef void (*evs_confchg_fn_t) (
unsigned int *member_list, int member_list_entries,
unsigned int *left_list, int left_list_entries,
unsigned int *joined_list, int joined_list_entries);
typedef struct {
evs_deliver_fn_t evs_deliver_fn;
evs_confchg_fn_t evs_confchg_fn;
} evs_callbacks_t;
/** @} */
/*
* Create a new evs connection
*/
evs_error_t evs_initialize (
evs_handle_t *handle,
evs_callbacks_t *callbacks);
/*
* Close the evs handle
*/
evs_error_t evs_finalize (
evs_handle_t handle);
/*
* Get a file descriptor on which to poll. evs_handle_t is NOT a
* file descriptor and may not be used directly.
*/
evs_error_t evs_fd_get (
evs_handle_t handle,
int *fd);
/*
* Dispatch messages and configuration changes
*/
evs_error_t evs_dispatch (
evs_handle_t handle,
evs_dispatch_t dispatch_types);
/*
* Join one or more groups.
* messages multicasted with evs_mcast_joined will be sent to every
* group that has been joined on handle handle. Any message multicasted
* to a group that has been previously joined will be delivered in evs_dispatch
*/
evs_error_t evs_join (
evs_handle_t handle,
struct evs_group *groups,
int group_cnt);
/*
* Leave one or more groups
*/
evs_error_t evs_leave (
evs_handle_t handle,
struct evs_group *groups,
int group_cnt);
/*
* Multicast to groups joined with evs_join.
* The iovec described by iovec will be multicasted to all groups joined with
* the evs_join interface for handle.
*/
evs_error_t evs_mcast_joined (
evs_handle_t handle,
evs_guarantee_t guarantee,
struct iovec *iovec,
int iov_len);
/*
* Multicast to specified groups.
* Messages will be multicast to groups specified in the api call and not those
* that have been joined (unless they are in the groups parameter).
*/
evs_error_t evs_mcast_groups (
evs_handle_t handle,
evs_guarantee_t guarantee,
struct evs_group *groups,
int group_cnt,
struct iovec *iovec,
int iov_len);
/*
* Get membership information from evs
*/
evs_error_t evs_membership_get (
evs_handle_t handle,
unsigned int *local_nodeid,
unsigned int *member_list,
unsigned int *member_list_entries);
#endif /* OPENAIS_EVS_H_DEFINED */