2004-06-24 12:02:38 +04:00
/*
* Copyright ( C ) 2002 - 2004 Sistina Software , Inc . All rights reserved .
2011-09-25 23:37:00 +04:00
* Copyright ( C ) 2004 - 2011 Red Hat , Inc . All rights reserved .
2004-06-24 12:02:38 +04:00
*
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
* of the GNU General Public License v .2 .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
*/
/*
* Abstraction layer for clvmd cluster communications
*/
# ifndef _CLVMD_COMMS_H
# define _CLVMD_COMMS_H
struct local_client ;
2005-01-13 16:24:02 +03:00
struct cluster_ops {
2011-09-25 23:37:00 +04:00
const char * name ;
2005-01-13 16:24:02 +03:00
void ( * cluster_init_completed ) ( void ) ;
2007-05-02 16:22:40 +04:00
int ( * cluster_send_message ) ( const void * buf , int msglen ,
const char * csid ,
const char * errtext ) ;
int ( * name_from_csid ) ( const char * csid , char * name ) ;
int ( * csid_from_name ) ( char * csid , const char * name ) ;
2005-01-13 16:24:02 +03:00
int ( * get_num_nodes ) ( void ) ;
int ( * cluster_fd_callback ) ( struct local_client * fd , char * buf , int len ,
2007-05-02 16:22:40 +04:00
const char * csid ,
struct local_client * * new_client ) ;
2005-01-13 16:24:02 +03:00
int ( * get_main_cluster_fd ) ( void ) ; /* gets accept FD or cman cluster socket */
int ( * cluster_do_node_callback ) ( struct local_client * client ,
2007-05-02 16:22:40 +04:00
void ( * callback ) ( struct local_client * ,
const char * csid ,
int node_up ) ) ;
2005-01-13 16:24:02 +03:00
int ( * is_quorate ) ( void ) ;
void ( * get_our_csid ) ( char * csid ) ;
2007-05-02 16:22:40 +04:00
void ( * add_up_node ) ( const char * csid ) ;
2005-04-19 14:36:42 +04:00
void ( * reread_config ) ( void ) ;
2005-01-13 16:24:02 +03:00
void ( * cluster_closedown ) ( void ) ;
2004-06-24 12:02:38 +04:00
2006-10-09 18:11:57 +04:00
int ( * get_cluster_name ) ( char * buf , int buflen ) ;
2007-05-02 16:22:40 +04:00
int ( * sync_lock ) ( const char * resource , int mode ,
int flags , int * lockid ) ;
2005-01-13 16:24:02 +03:00
int ( * sync_unlock ) ( const char * resource , int lockid ) ;
2004-06-24 12:02:38 +04:00
2005-01-13 16:24:02 +03:00
} ;
2004-06-24 12:02:38 +04:00
2005-01-13 16:24:02 +03:00
# ifdef USE_CMAN
2006-03-15 11:36:11 +03:00
# include <netinet / in.h>
2006-03-14 17:18:34 +03:00
# include "libcman.h"
2005-01-13 16:24:02 +03:00
# define CMAN_MAX_CSID_LEN 4
# ifndef MAX_CSID_LEN
# define MAX_CSID_LEN CMAN_MAX_CSID_LEN
# endif
# undef MAX_CLUSTER_MEMBER_NAME_LEN
2006-03-14 17:18:34 +03:00
# define MAX_CLUSTER_MEMBER_NAME_LEN CMAN_MAX_NODENAME_LEN
# define CMAN_MAX_CLUSTER_MESSAGE 1500
# define CLUSTER_PORT_CLVMD 11
2005-01-13 16:24:02 +03:00
struct cluster_ops * init_cman_cluster ( void ) ;
2004-06-24 12:02:38 +04:00
# endif
2007-05-21 14:52:01 +04:00
# ifdef USE_OPENAIS
# include <openais / saAis.h>
2009-08-28 23:22:05 +04:00
# include <corosync / totem / totem.h>
2007-05-21 14:52:01 +04:00
# define OPENAIS_CSID_LEN (sizeof(int))
# define OPENAIS_MAX_CLUSTER_MESSAGE MESSAGE_SIZE_MAX
# define OPENAIS_MAX_CLUSTER_MEMBER_NAME_LEN SA_MAX_NAME_LENGTH
# ifndef MAX_CLUSTER_MEMBER_NAME_LEN
# define MAX_CLUSTER_MEMBER_NAME_LEN SA_MAX_NAME_LENGTH
# endif
# ifndef CMAN_MAX_CLUSTER_MESSAGE
# define CMAN_MAX_CLUSTER_MESSAGE MESSAGE_SIZE_MAX
# endif
# ifndef MAX_CSID_LEN
# define MAX_CSID_LEN sizeof(int)
# endif
struct cluster_ops * init_openais_cluster ( void ) ;
# endif
2004-06-24 12:02:38 +04:00
2009-01-22 13:21:12 +03:00
# ifdef USE_COROSYNC
# include <corosync / corotypes.h>
# define COROSYNC_CSID_LEN (sizeof(int))
# define COROSYNC_MAX_CLUSTER_MESSAGE 65535
# define COROSYNC_MAX_CLUSTER_MEMBER_NAME_LEN CS_MAX_NAME_LENGTH
# ifndef MAX_CLUSTER_MEMBER_NAME_LEN
# define MAX_CLUSTER_MEMBER_NAME_LEN CS_MAX_NAME_LENGTH
# endif
# ifndef CMAN_MAX_CLUSTER_MESSAGE
# define CMAN_MAX_CLUSTER_MESSAGE 65535
# endif
# ifndef MAX_CSID_LEN
# define MAX_CSID_LEN sizeof(int)
# endif
struct cluster_ops * init_corosync_cluster ( void ) ;
# endif
2010-03-18 12:19:30 +03:00
# ifdef USE_SINGLENODE
# define SINGLENODE_CSID_LEN (sizeof(int))
2010-03-23 17:35:08 +03:00
# ifndef MAX_CLUSTER_MEMBER_NAME_LEN
# define MAX_CLUSTER_MEMBER_NAME_LEN 64
# endif
2010-03-18 12:19:30 +03:00
# define SINGLENODE_MAX_CLUSTER_MESSAGE 65535
2010-03-23 17:35:08 +03:00
# ifndef MAX_CSID_LEN
# define MAX_CSID_LEN sizeof(int)
# endif
2010-03-18 12:19:30 +03:00
struct cluster_ops * init_singlenode_cluster ( void ) ;
# endif
2006-03-14 17:18:34 +03:00
2004-06-24 12:02:38 +04:00
# endif