1
/******************************************************************************
2
*******************************************************************************
4
** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5
** Copyright (C) 2004 Red Hat, Inc. All rights reserved.
7
** This copyrighted material is made available to anyone wishing to use,
8
** modify, copy, or redistribute it subject to the terms and conditions
9
** of the GNU General Public License v.2.
11
*******************************************************************************
12
******************************************************************************/
14
/* CMAN socket interface header,
15
may be include by user or kernel code */
17
#ifndef __CNXMAN_SOCKET_H
18
#define __CNXMAN_SOCKET_H
20
/* A currently unused number. TIPC also uses this number and you're unlikely
24
#define PF_CLUSTER AF_CLUSTER
26
/* Protocol(socket) types */
27
#define CLPROTO_MASTER 2
28
#define CLPROTO_CLIENT 3
30
/* ioctls -- should register these properly */
31
#define SIOCCLUSTER_NOTIFY _IOW('x', 0x01, int)
32
#define SIOCCLUSTER_REMOVENOTIFY _IO( 'x', 0x02)
33
#define SIOCCLUSTER_GETMEMBERS _IOR('x', 0x03, struct cl_cluster_nodelist)
34
#define SIOCCLUSTER_SETEXPECTED_VOTES _IOW('x', 0x04, int)
35
#define SIOCCLUSTER_ISQUORATE _IO( 'x', 0x05)
36
#define SIOCCLUSTER_ISLISTENING _IOW('x', 0x06, struct cl_listen_request)
37
#define SIOCCLUSTER_GETALLMEMBERS _IOR('x', 0x07, struct cl_cluster_nodelist)
38
#define SIOCCLUSTER_SET_VOTES _IOW('x', 0x08, int)
39
#define SIOCCLUSTER_GET_VERSION _IOR('x', 0x09, struct cl_version)
40
#define SIOCCLUSTER_SET_VERSION _IOW('x', 0x0a, struct cl_version)
41
#define SIOCCLUSTER_ISACTIVE _IO( 'x', 0x0b)
42
#define SIOCCLUSTER_KILLNODE _IOW('x', 0x0c, int)
43
#define SIOCCLUSTER_GET_JOINCOUNT _IO( 'x', 0x0d)
44
#define SIOCCLUSTER_SERVICE_REGISTER _IOW('x', 0x0e, char)
45
#define SIOCCLUSTER_SERVICE_UNREGISTER _IO('x', 0x0f)
46
#define SIOCCLUSTER_SERVICE_JOIN _IO( 'x', 0x10)
47
#define SIOCCLUSTER_SERVICE_LEAVE _IO( 'x', 0x20)
48
#define SIOCCLUSTER_SERVICE_SETSIGNAL _IOW('x', 0x30, int)
49
#define SIOCCLUSTER_SERVICE_STARTDONE _IOW('x', 0x40, unsigned int)
50
#define SIOCCLUSTER_SERVICE_GETEVENT _IOR('x', 0x50, struct cl_service_event)
51
#define SIOCCLUSTER_SERVICE_GETMEMBERS _IOR('x', 0x60, struct cl_cluster_nodelist)
52
#define SIOCCLUSTER_SERVICE_GLOBALID _IOR('x', 0x70, uint32_t)
53
#define SIOCCLUSTER_SERVICE_SETLEVEL _IOR('x', 0x80, int)
54
#define SIOCCLUSTER_GETNODE _IOWR('x', 0x90, struct cl_cluster_node)
55
#define SIOCCLUSTER_BARRIER _IOW('x', 0x0a0, struct cl_barrier_info)
57
/* These were setsockopts */
58
#define SIOCCLUSTER_PASS_SOCKET _IOW('x', 0x0b0, struct cl_passed_sock)
59
#define SIOCCLUSTER_SET_NODENAME _IOW('x', 0x0b1, char *)
60
#define SIOCCLUSTER_SET_NODEID _IOW('x', 0x0b2, int)
61
#define SIOCCLUSTER_JOIN_CLUSTER _IOW('x', 0x0b3, struct cl_join_cluster_info)
62
#define SIOCCLUSTER_LEAVE_CLUSTER _IOW('x', 0x0b4, int)
65
/* Maximum size of a cluster message */
66
#define MAX_CLUSTER_MESSAGE 1500
67
#define MAX_CLUSTER_MEMBER_NAME_LEN 255
68
#define MAX_BARRIER_NAME_LEN 33
69
#define MAX_SA_ADDR_LEN 12
70
#define MAX_CLUSTER_NAME_LEN 16
72
/* Well-known cluster port numbers */
73
#define CLUSTER_PORT_MEMBERSHIP 1 /* Mustn't block during cluster
75
#define CLUSTER_PORT_SERVICES 2
76
#define CLUSTER_PORT_SYSMAN 10 /* Remote execution daemon */
77
#define CLUSTER_PORT_CLVMD 11 /* Cluster LVM daemon */
78
#define CLUSTER_PORT_SLM 12 /* LVM SLM (simple lock manager) */
80
/* Port numbers above this will be blocked when the cluster is inquorate or in
82
#define HIGH_PROTECTED_PORT 9
84
/* Reasons for leaving the cluster */
85
#define CLUSTER_LEAVEFLAG_DOWN 0 /* Normal shutdown */
86
#define CLUSTER_LEAVEFLAG_KILLED 1
87
#define CLUSTER_LEAVEFLAG_PANIC 2
88
#define CLUSTER_LEAVEFLAG_REMOVED 3 /* This one can reduce quorum */
89
#define CLUSTER_LEAVEFLAG_REJECTED 4 /* Not allowed into the cluster in the
91
#define CLUSTER_LEAVEFLAG_INCONSISTENT 5 /* Our view of the cluster is
93
#define CLUSTER_LEAVEFLAG_DEAD 6 /* Discovered to be dead */
94
#define CLUSTER_LEAVEFLAG_FORCE 0x10 /* Forced by command-line */
96
/* OOB messages sent to a local socket */
97
#define CLUSTER_OOB_MSG_PORTCLOSED 1
98
#define CLUSTER_OOB_MSG_STATECHANGE 2
99
#define CLUSTER_OOB_MSG_SERVICEEVENT 3
101
/* Sendmsg flags, these are above the normal sendmsg flags so they don't
103
#define MSG_NOACK 0x010000 /* Don't need an ACK for this message */
104
#define MSG_QUEUE 0x020000 /* Queue the message for sending later */
105
#define MSG_MULTICAST 0x080000 /* Message was sent to all nodes in the cluster
107
#define MSG_ALLINT 0x100000 /* Send out of all interfaces */
108
#define MSG_REPLYEXP 0x200000 /* Reply is expected */
110
typedef enum { NODESTATE_REMOTEMEMBER, NODESTATE_JOINING, NODESTATE_MEMBER,
111
NODESTATE_DEAD } nodestate_t;
115
unsigned short scl_family;
116
unsigned char scl_flags;
117
unsigned char scl_port;
122
* This is how we pass the multicast & receive sockets into kernel space.
124
struct cl_passed_sock {
125
int fd; /* FD of master socket to do multicast on */
126
int number; /* Socket number, to match up recvonly & bcast
128
int multicast; /* Is it multicast or receive ? */
131
/* Cluster configuration info passed when we join the cluster */
132
struct cl_join_cluster_info {
134
unsigned int expected_votes;
135
unsigned int two_node;
136
unsigned int config_version;
138
char cluster_name[17];
142
/* This is the structure, per node, returned from the membership ioctl */
143
struct cl_cluster_node {
145
unsigned int node_id;
147
unsigned int leave_reason;
148
unsigned int incarnation;
150
char name[MAX_CLUSTER_MEMBER_NAME_LEN];
154
/* The struct passed to the membership ioctls */
155
struct cl_cluster_nodelist {
156
uint32_t max_members;
157
struct cl_cluster_node *nodes;
160
/* Structure passed to SIOCCLUSTER_ISLISTENING */
161
struct cl_listen_request {
166
/* A Cluster PORTCLOSED message - received by a local user as an OOB message */
167
struct cl_portclosed_oob {
168
unsigned char cmd; /* CLUSTER_OOB_MSG_PORTCLOSED */
172
/* Get all version numbers or set the config version */
180
/* structure passed to barrier ioctls */
181
struct cl_barrier_info {
183
char name[MAX_BARRIER_NAME_LEN];
188
typedef enum { SERVICE_EVENT_STOP, SERVICE_EVENT_START, SERVICE_EVENT_FINISH,
189
SERVICE_EVENT_LEAVEDONE } service_event_t;
191
typedef enum { SERVICE_START_FAILED, SERVICE_START_JOIN, SERVICE_START_LEAVE }
194
struct cl_service_event {
195
service_event_t type;
196
service_start_t start_type;
197
unsigned int event_id;
198
unsigned int last_stop;
199
unsigned int last_start;
200
unsigned int last_finish;
201
unsigned int node_count;
205
/* Commands to the barrier ioctl */
206
#define BARRIER_IOCTL_REGISTER 1
207
#define BARRIER_IOCTL_CHANGE 2
208
#define BARRIER_IOCTL_DELETE 3
209
#define BARRIER_IOCTL_WAIT 4
211
/* Attributes of a barrier - bitmask */
212
#define BARRIER_ATTR_AUTODELETE 1
213
#define BARRIER_ATTR_MULTISTEP 2
214
#define BARRIER_ATTR_MANUAL 4
215
#define BARRIER_ATTR_ENABLED 8
216
#define BARRIER_ATTR_CALLBACK 16
218
/* Attribute setting commands */
219
#define BARRIER_SETATTR_AUTODELETE 1
220
#define BARRIER_SETATTR_MULTISTEP 2
221
#define BARRIER_SETATTR_ENABLED 3
222
#define BARRIER_SETATTR_NODES 4
223
#define BARRIER_SETATTR_CALLBACK 5
224
#define BARRIER_SETATTR_TIMEOUT 6