/usr/include/ocf/oc_membership.h is in libheartbeat2-dev 1:3.0.6-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | #ifndef OCF_OC_MEMBERSHIP_H
# define OCF_OC_MEMBERSHIP_H
/*
* <ocf/oc_membership.h> - membership APIs (version 0.1)
*
* The structures and functions in this header file work closely with
* the oc_event.h event infrastructure. All (edata, esize) parameters
* to functions in this header file refer to membership event bodies.
* It is expected that all such are received by this mechanism.
*
*
* There are a few things in this header file which don't really belong here
* but are needed and they aren't in any other header file.
*
* These are:
* definition of oc_node_id_t
* oc_cluster_handle_t
*
* Maybe we ought to put common types into an <ocf/oc_types.h>
*
* The oc_cmp_node_id() and oc_localnodeid() functions also belong in
* some more global header file.
*
* oc_member_eventttype_t and * oc_member_uniqueid_t are membership-unique
* and don't belong in a set of ocf-common header files (IMHO)
*
* Copyright (C) 2002 Alan Robertson <alanr@unix.sh>
*
* This copyright will be assigned to the Free Standards Group
* in the future.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of version 2.1 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stddef.h>
#include <ocf/oc_event.h>
#include <clplumbing/cl_uuid.h>
/*
* This enumeration is used both to indicated the type of an event
* received, and to request the types of events one wants delivered.
* (see oc_member_request_events() and oc_member_etype() for more
* details on how this is used).
*/
enum oc_member_eventtype_e {
OC_NOT_MEMBERSHIP, /* Not a (valid) membership event */
OC_FULL_MEMBERSHIP, /* full membership update */
OC_INCR_MEMBERSHIP /* incremental membership update */
};
typedef enum oc_member_eventtype_e oc_member_eventtype_t;
/* controversial? */
typedef void * oc_cluster_handle_t;
typedef cl_uuid_t oc_node_id_t;
typedef struct oc_member_uniqueid_s oc_member_uniqueid_t;
/*
* A few words about the oc_node_id_t:
*
* An oc_node_id_t is assigned to a node no later than when it first
* joins a cluster, and it will not change while that node is active
* in some partition in the cluster. It is normally expected to
* be assigned to a node, and not changed afterwards except by
* adminstrative intervention.
*
* The mechanism for assigning oc_node_id_t's to nodes is outside the
* scope of this specification. The only basic operation which
* can be performed on these objects is comparison.
*
* See oc_cmp_node_id() for comparisons between them.
*/
/*
* oc_member_uniqueid_t
* The values of these fields are guaranteed to be the same across
* all nodes within a given partition, and guaranteed to be different
* between all active partitions in the cluster.
*
* In other words, if you exchange current oc_member_uniqueid_t objects
* with another cluster node, you can tell with certainty, whether or not
* you and the other node are currently members of the same partition.
*
* The m_instance field is guaranteed to be unique to a particular
* membership instance while that node is active in the cluster.
* If a node is shut down and restarts, then the m_instance might
* repeat a value it had in the past.
*
* See oc_cmp_uniqueid() for comparing them.
*
* The meaning of the uniqueid field is not defined by this specification.
* It may be the node_id of a node in the cluster or it may be a unique
* checksum or it may be some other value. All that is specified is that
* it and the m_instance are unique when taken as a whole.
*/
typedef unsigned char oc_mbr_uniqueid[16];
struct oc_member_uniqueid_s {
unsigned m_instance;
oc_mbr_uniqueid uniqueid;
};
#ifdef __cplusplus
extern "C" {
#endif
/*
* Returns 0 for equal node_ids,
* negative for node id l less than node id r
* positive for node id l greater than node id r
*
* No meaning may be ascribed to the fact that a particular
* node id is greater or less than some other node id.
* The comparison operator is provided primarily for
* equality comparisons, and secondarily for use in
* sorting them into a canonical order.
*/
int oc_cmp_node_id(const oc_node_id_t* l, const oc_node_id_t* r);
/* Return our local node id */
int oc_localnodeid(oc_node_id_t* us, oc_cluster_handle_t handle);
/*
* On failure these functions return -1:
* The following errno values are defined:
* EINVAL invalid handle argument
* EL2HLT cluster software not currently running
*/
/* What kind of event did we get? */
/* (see oc_member_request_events() for more details) */
oc_member_eventtype_t oc_member_etype(const void* edata, size_t esize);
/*
* oc_member_uniqueid() returns the unique identifier associated
* with this membership event. See the description in the typedef
* for more details.
*/
int oc_member_uniqueid(const void* edata, size_t esize,
oc_member_uniqueid_t* u);
/*
* Failure of these functions return -1.
* The following errno values are defined:
* EL2HLT cluster software not currently running
* EINVAL edata does not refer to a membership event
*/
/* How many nodes of each category do we have? */
int oc_member_n_nodesjoined(const void* edata, size_t esize);
int oc_member_n_nodesgone(void* edata, size_t esize);
int oc_member_n_nodesconst(void* edata, size_t esize);
/*
* Failure of these functions return -1.
* The following errno values are defined:
* EL2HLT cluster software not currently running
* EINVAL edata does not refer to a membership event
* ENOSYS edata refers to an OC_INCR_MEMBERSHIP update, and
* oc_member_n_nodesconst() was called.
*/
/* What nodes of each category do we have? */
oc_node_id_t* oc_member_nodesjoined(const void* edata, size_t esize);
oc_node_id_t* oc_member_nodesgone(void* edata, size_t esize);
oc_node_id_t* oc_member_nodesconst(void* edata, size_t esize);
/*
* Failure of these functions return NULL.
* The following errno values are defined:
* EL2HLT cluster software not currently running
* EINVAL edata does not refer to a membership event
* ENOSYS edata refers to an OC_INCR_MEMBERSHIP update, and
* oc_member_nodesconst() was called.
*/
/*
*
* OC_NO_MEMBERSHIP
* No membership events will be delivered. This is the default on opening
* a membership event connection.
*
* OC_FULL_MEMBERSHIP
* Deliver all membership information including information on
* members that didn't change. In this mode, the oc_member_nodesconst()
* call is supported.
*
* OC_INCR_MEMBERSHIP
* Deliver only changed membership events. In this mode, calls to
* oc_member_nodesconst(), et al. are not supported.
*
* Setting OC_FULL_MEMBERSHIP or OC_INCR_MEMBERSHIP will result in the
* delivery of a single OC_FULL_MEMBERSHIP event soon after making
* this call. Subsequent events will be delivered as received in the
* requested style (incremental or full). Because events may already
* be pending when this operation is issued, no guarantee can be made
* regarding when this triggered event will be delivered.
*
*/
int oc_member_request_events(oc_member_eventtype_t etype, oc_ev_t token);
/*
* On failure this function returns -1:
* The following errno values are defined:
* EINVAL invalid etype or handle argument
* EL2HLT cluster software not currently running
* EBADF invalid oc_ev_t token parameter
*/
/*
* if l.m_instance < r.m_instance then return -1
* if r.m_instance > r.m_instance then return 1
* if l.m_instance == r.m_instance and l.uniqueid == r.uniqueid
* then return 0
* otherwise return 2
*/
int oc_cmp_uniqueid(const oc_member_uniqueid_t l, const oc_member_uniqueid_t r);
#ifdef __cplusplus
}
#endif
#endif
|