clvmd-comms.h revision 1.1 1 1.1 haad /* $NetBSD: clvmd-comms.h,v 1.1 2008/12/22 00:18:49 haad Exp $ */
2 1.1 haad
3 1.1 haad /*
4 1.1 haad * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
5 1.1 haad * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
6 1.1 haad *
7 1.1 haad * This file is part of LVM2.
8 1.1 haad *
9 1.1 haad * This copyrighted material is made available to anyone wishing to use,
10 1.1 haad * modify, copy, or redistribute it subject to the terms and conditions
11 1.1 haad * of the GNU General Public License v.2.
12 1.1 haad *
13 1.1 haad * You should have received a copy of the GNU General Public License
14 1.1 haad * along with this program; if not, write to the Free Software Foundation,
15 1.1 haad * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 1.1 haad */
17 1.1 haad
18 1.1 haad /*
19 1.1 haad * Abstraction layer for clvmd cluster communications
20 1.1 haad */
21 1.1 haad
22 1.1 haad #ifndef _CLVMD_COMMS_H
23 1.1 haad #define _CLVMD_COMMS_H
24 1.1 haad
25 1.1 haad struct local_client;
26 1.1 haad
27 1.1 haad struct cluster_ops {
28 1.1 haad void (*cluster_init_completed) (void);
29 1.1 haad
30 1.1 haad int (*cluster_send_message) (const void *buf, int msglen,
31 1.1 haad const char *csid,
32 1.1 haad const char *errtext);
33 1.1 haad int (*name_from_csid) (const char *csid, char *name);
34 1.1 haad int (*csid_from_name) (char *csid, const char *name);
35 1.1 haad int (*get_num_nodes) (void);
36 1.1 haad int (*cluster_fd_callback) (struct local_client *fd, char *buf, int len,
37 1.1 haad const char *csid,
38 1.1 haad struct local_client **new_client);
39 1.1 haad int (*get_main_cluster_fd) (void); /* gets accept FD or cman cluster socket */
40 1.1 haad int (*cluster_do_node_callback) (struct local_client *client,
41 1.1 haad void (*callback) (struct local_client *,
42 1.1 haad const char *csid,
43 1.1 haad int node_up));
44 1.1 haad int (*is_quorate) (void);
45 1.1 haad
46 1.1 haad void (*get_our_csid) (char *csid);
47 1.1 haad void (*add_up_node) (const char *csid);
48 1.1 haad void (*reread_config) (void);
49 1.1 haad void (*cluster_closedown) (void);
50 1.1 haad
51 1.1 haad int (*get_cluster_name)(char *buf, int buflen);
52 1.1 haad
53 1.1 haad int (*sync_lock) (const char *resource, int mode,
54 1.1 haad int flags, int *lockid);
55 1.1 haad int (*sync_unlock) (const char *resource, int lockid);
56 1.1 haad
57 1.1 haad };
58 1.1 haad
59 1.1 haad #ifdef USE_GULM
60 1.1 haad # include "tcp-comms.h"
61 1.1 haad struct cluster_ops *init_gulm_cluster(void);
62 1.1 haad #define MAX_CSID_LEN GULM_MAX_CSID_LEN
63 1.1 haad #define MAX_CLUSTER_MEMBER_NAME_LEN GULM_MAX_CLUSTER_MEMBER_NAME_LEN
64 1.1 haad #endif
65 1.1 haad
66 1.1 haad #ifdef USE_CMAN
67 1.1 haad # include <netinet/in.h>
68 1.1 haad # include "libcman.h"
69 1.1 haad # define CMAN_MAX_CSID_LEN 4
70 1.1 haad # ifndef MAX_CSID_LEN
71 1.1 haad # define MAX_CSID_LEN CMAN_MAX_CSID_LEN
72 1.1 haad # endif
73 1.1 haad # undef MAX_CLUSTER_MEMBER_NAME_LEN
74 1.1 haad # define MAX_CLUSTER_MEMBER_NAME_LEN CMAN_MAX_NODENAME_LEN
75 1.1 haad # define CMAN_MAX_CLUSTER_MESSAGE 1500
76 1.1 haad # define CLUSTER_PORT_CLVMD 11
77 1.1 haad struct cluster_ops *init_cman_cluster(void);
78 1.1 haad #endif
79 1.1 haad
80 1.1 haad #ifdef USE_OPENAIS
81 1.1 haad # include <openais/saAis.h>
82 1.1 haad # include <openais/totem/totem.h>
83 1.1 haad # define OPENAIS_CSID_LEN (sizeof(int))
84 1.1 haad # define OPENAIS_MAX_CLUSTER_MESSAGE MESSAGE_SIZE_MAX
85 1.1 haad # define OPENAIS_MAX_CLUSTER_MEMBER_NAME_LEN SA_MAX_NAME_LENGTH
86 1.1 haad # ifndef MAX_CLUSTER_MEMBER_NAME_LEN
87 1.1 haad # define MAX_CLUSTER_MEMBER_NAME_LEN SA_MAX_NAME_LENGTH
88 1.1 haad # endif
89 1.1 haad # ifndef CMAN_MAX_CLUSTER_MESSAGE
90 1.1 haad # define CMAN_MAX_CLUSTER_MESSAGE MESSAGE_SIZE_MAX
91 1.1 haad # endif
92 1.1 haad # ifndef MAX_CSID_LEN
93 1.1 haad # define MAX_CSID_LEN sizeof(int)
94 1.1 haad # endif
95 1.1 haad struct cluster_ops *init_openais_cluster(void);
96 1.1 haad #endif
97 1.1 haad
98 1.1 haad
99 1.1 haad #endif
100