2 .\" * Copyright (c) 2006 Red Hat, Inc.
4 .\" * All rights reserved.
6 .\" * Author: Patrick Caulfield <pcaulfie@redhat.com>
8 .\" * This software licensed under BSD license, the text of which follows:
10 .\" * Redistribution and use in source and binary forms, with or without
11 .\" * modification, are permitted provided that the following conditions are met:
13 .\" * - Redistributions of source code must retain the above copyright notice,
14 .\" * this list of conditions and the following disclaimer.
15 .\" * - Redistributions in binary form must reproduce the above copyright notice,
16 .\" * this list of conditions and the following disclaimer in the documentation
17 .\" * and/or other materials provided with the distribution.
18 .\" * - Neither the name of the MontaVista Software, Inc. nor the names of its
19 .\" * contributors may be used to endorse or promote products derived from this
20 .\" * software without specific prior written permission.
22 .\" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 .\" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 .\" * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 .\" * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 .\" * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 .\" * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 .\" * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 .\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32 .\" * THE POSSIBILITY OF SUCH DAMAGE.
34 .TH CPG_INITIALIZE 3 2004-08-31 "openais Man Page" "Openais Programmer's Manual"
36 cpg_initialize \- Create a new connection to the CPG service
38 .B #include <openais/cpg.h>
40 .BI "int cpg_initialize(cpg_handle_t *" handle ", cpg_callbacks_t *" callbacks ");
44 function is used to initialize a connection to the closed process groups API.
46 Each application may have several connections to the CPG API. Each application
49 argument to uniquely identify the connection. The
51 argument is then used in other function calls to identify the connection to be used
52 for communication with the CPG service.
54 Every time an CPG event occurs within the joined group, one of the callbacks specified by the argument
56 is called. The callback functions are described by the following type definitions:
65 typedef void (*cpg_deliver_fn_t) (
67 struct cpg_name *group_name,
74 typedef void (*cpg_confchg_fn_t) (
76 struct cpg_name *group_name,
77 struct cpg_address *member_list, int member_list_entries,
78 struct cpg_address *left_list, int left_list_entries,
79 struct cpg_address *joined_list, int joined_list_entries);
88 argument is of the type:
95 cpg_deliver_fn_t cpg_deliver_fn;
96 cpg_confchg_fn_t cpg_confchg_fn;
103 When a configuration change occurs or a message is to be delivered one of the callbacks
106 function. If a configuration change occurs,
108 is called. If a delivery of a message occurs,
130 where nodeid is a 32 bit unique node identifier, pid is the process ID of the process that has joined/left the group
131 or sent the message, and reason is an integer code indicating why the node join/left the group.
138 CPG_REASON_JOIN - the process joined a group using cpg_join().
139 CPG_REASON_LEAVE - the process left a group using cpg_leave()
140 CPG_REASON_NODEDOWN - the process left a group because the node left the cluster.
141 CPG_REASON_NODEUP - the process joined a group because it was already a member of a group on a node that has just joined the cluster
142 CPG_REASON_PROCDOWN - the process left a group without calling cpg_leave()
149 This call returns the CPG_OK value if successful, otherwise an error is returned.
152 The errors are undocumented.
154 .BR cpg_overview (8),
155 .BR cpg_finalize (3),
157 .BR cpg_dispatch (3),
160 .BR cpg_mcast_joined (3),
161 .BR cpg_membership_get (3)