1CPG_INITIALIZE(3)         Openais Programmer's Manual        CPG_INITIALIZE(3)
2
3
4

NAME

6       evs_initialize - Create a new connection to the CPG service
7

SYNOPSIS

9       #include <openais/cpg.h>
10
11       int cpg_initialize(evs_handle_t *handle, cpg_callbacks_t *callbacks);
12

DESCRIPTION

14       The  cpg_initialize  function is used to initialize a connection to the
15       closed process groups API.
16
17       Each application may have several connections to  the  CPG  API.   Each
18       application  uses  the handle argument to uniquely identify the connec‐
19       tion.  The handle argument is then used  in  other  function  calls  to
20       identify  the connection to be used for communication with the CPG ser‐
21       vice.
22
23       Every time an CPG event occurs within the  joined  group,  one  of  the
24       callbacks  specified by the argument callbacks is called.  The callback
25       functions are described by the following type definitions:
26
27              typedef void (*cpg_deliver_fn_t) (
28                      cpg_handle_t handle,
29                      struct cpg_name *group_name,
30                      uint32_t nodeid,
31                      uint32_t pid,
32                      void *msg,
33                      int msg_len);
34
35
36              typedef void (*cpg_confchg_fn_t) (
37                      cpg_handle_t handle,
38                      struct cpg_name *group_name,
39                      struct cpg_address *member_list, int member_list_entries,
40                      struct cpg_address *left_list, int left_list_entries,
41                      struct cpg_address *joined_list, int joined_list_entries);
42
43       The callbacks argument is of the type:
44
45              typedef struct {
46                      cpg_deliver_fn_t cpg_deliver_fn;
47                      cpg_confchg_fn_t cpg_confchg_fn;
48              } cpg_callbacks_t;
49
50       When a configuration change occurs or a message is to be delivered  one
51       of the callbacks is called from the cpg_dispatch() function.  If a con‐
52       figuration change occurs, cpg_confchg_fn is called.  If a delivery of a
53       message occurs, cpg_deliver_fn is called.
54
55       The cpg_address structure is defined
56
57              struct cpg_address {
58                      unsigned int nodeid;
59                      unsigned int pid;
60                      unsigned int reason;
61              };
62
63       where  nodeid is a 32 bit unique node identifier, pid is the process ID
64       of the process that has joined/left the group or sent the message,  and
65       reason is an integer code indicating why the node join/left the group.
66
67              CPG_REASON_JOIN     - the process joined a group using cpg_join().
68              CPG_REASON_LEAVE    - the process left a group using cpg_leave()
69              CPG_REASON_NODEDOWN - the process left a group because the node left the cluster.
70              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
71              CPG_REASON_PROCDOWN - the process left a group without calling cpg_leave()
72

RETURN VALUE

74       This call returns the CPG_OK value if successful, otherwise an error is
75       returned.
76

ERRORS

78       The errors are undocumented.
79

SEE ALSO

81       cpg_overview(8),   cpg_finalize(3),   cpg_fd_get(3),   cpg_dispatch(3),
82       cpg_join(3), cpg_leave(3), cpg_mcast_joined(3), cpg_mmembership_get(3)
83
84openais Man Page                  2004-08-31                 CPG_INITIALIZE(3)
Impressum