Debian Codegraph @

doc/heartbeat_api.html

raw
1 <!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
2 <html>
3 <head>
4
5 <meta http-equiv="Content-Type"
6 content="text/html; charset=iso-8859-1">
7 <title>HEARTBEAT API</title>
8 </head>
9 <body>
10
11 <h1>HEARTBEAT API</h1>
12
13 <h1>Introduction:</h1>
14 <font size="+1" face="Arial,Helvetica"><b>This document describes the application
15 program interface for heartbeat. The following are the interfaces available
16 for heartbeat</b>.</font>
17 <ol>
18 <li> <b><font color="#3333ff"><font size="+2"><a
19 href="#ll_cluster_new%28%29">ll_cluster_new()</a></font></font></b></li>
20 <li> <b><font size="+2"><a href="#signon%28%29">singon()</a></font></b></li>
21 <li> <b><font size="+2"><a href="#signoff%28%29">signoff()</a></font></b></li>
22 <li> <b><font size="+2"><a href="#delete%28%29">delete()</a></font></b></li>
23 <li> <b><font size="+2"><a href="#set_msg_callback%28%29">set_msg_callback()</a></font></b></li>
24 <li> <b><font size="+2"><a href="#set_nstatus_callback%28%29">set_nstatus_callback()</a></font></b></li>
25 <li> <b><font size="+2"><a href="#set_ifstatus_callback%28%29">set _ifstatus_callback()</a></font></b></li>
26 <li> <b><font size="+2"><a href="#init_nodewalk%28%29">init_nodewalk()</a></font></b></li>
27 <li> <b><font size="+2"><a href="#nextnode%28%29">nextnode()</a></font></b></li>
28 <li> <b><font size="+2"><a href="#end_nodewalk%28%29">end_nodewalk()</a></font></b></li>
29 <li> <b><font size="+2"><a href="#init_ifwalk%28%29">init_ifwalk()</a></font></b></li>
30 <li> <b><font size="+2"><a href="#nextif%28ll_cluster_t%20*cinfo%29">nextif()</a></font></b></li>
31 <li> <b><font size="+2"><a href="#end_ifwalk%28%29">end_ifwalk()</a></font></b></li>
32 <li> <b><font size="+2"><a href="#if_status%28%29">if_status()</a></font></b></li>
33 <li> <b><font size="+2"><a href="#sendclustermsg%28%29">sendclustermsg()</a></font></b></li>
34 <li> <b><font size="+2"><a href="#sendnodemsg%28%29">sendnodemsg()</a></font></b></li>
35 <li> <b><font size="+2"><a href="#inputfd%28%29">inputfd()</a></font></b></li>
36 <li> <b><font size="+2"><a href="#msgready%28%29">msgready()</a></font></b></li>
37 <li> <b><font size="+2"><a href="#setmsgsignal%28%29">setmsgsignal()</a></font></b></li>
38 <li> <b><font size="+2"><a href="#rcvmsg%28%29">rcvmsg()</a></font></b></li>
39 <li> <b><font size="+2"><a href="#readmsg%28%29">readmsg()</a></font></b></li>
40 <li> <b><font size="+2"><a href="#setfmode%28%29">setfmode()</a></font></b></li>
41 <li><a href="#get_parameter"><b><font color="blue"><big><big>get_parameter()</big></big></font></b></a></li>
42 <li><a href="#get_deadtime"><b><font color="blue"><big><big>get_deadtime()</big></big></font></b></a><br>
43 </li>
44 <li><a href="#get_keepalive"><b><font color="blue"><big><big>get_keepalive()</big></big></font></b></a></li>
45 <li><a href="#get_mynodeid"><b><font color="blue"><big><big>get_mynodeid()</big></big></font></b></a><br>
46 </li>
47 <li><a href="#get_logfacility"><b><font color="blue"><big><big>get_logfacility()</big></big></font></b></a></li>
48 <li><a href="#get_resources"><b><font color="blue"><big><big>get_resources()</big></big></font></b></a><br>
49 </li>
50 <li><b><font size="+2"><a href="#errmsg%28%29">errmsg()</a></font></b></li>
51
52 </ol>
53
54 <h1>Description:</h1>
55 <b>The details of each of the api functions are as follows:</b>
56 <h2><a name="ll_cluster_new()"><b><font size="+2">ll_cluster_new()</font></b></a></h2>
57 <i><font color="#3333ff"><font size="+2"> ll_cluster_t *ll_cluster_new(const
58 char *type)</font></font></i>
59 <dl>
60 <dt><font color="#ff0000"><i><font size="+1">Parameter description</font></i>:</font></dt>
61 <dd>'<i><font color="#cc33cc">type</font></i>' identifies the service provider.
62 It's value must currently be "heartbeat". </dd>
63 <dt><i><font size="+1"><font color="#ff0000">Description</font>:</font></i></dt>
64 <dd> Register with the heartbeat library and create a client instance
65 of type "heartbeat" </dd>
66 <dt><i><font color="#ff0000" size="+1">Return Value:</font></i></dt>
67 <dd> returns a handle to the heartbeat library instance. This handle is
68 a opaque object with a set of member functions. The member functions provide
69 the necessary mechanism to interact with the heartbeat daemon. Returns <b>NULL</b>
70 on failure. </dd>
71 <dt><i><font color="#ff0000"><font size="+1">Observation:</font></font></i></dt>
72 <dd> Why is '<i><font color="#cc66cc">type'</font></i> parameter required
73 when we know for sure that we are only interacting with the heartbeat daemon?
74 Or is it that the library wants to be generic and wants to interact with
75 any arbitrary daemon? <b><font color="#ff0000">Yes. &nbsp;The latter.</font></b>
76 </dd>
77 </dl>
78
79 <h2><a name="signon()"><font size="+2">signon()</font></a></h2>
80 <i><font color="#3366ff"><font size="+2">int *signon(struct ll_cluster cinfo*,
81 const char *service)</font></font></i>
82 <dl>
83 <dt> <i><font color="#ff0000"><font size="+1">Parameter Description:</font></font></i></dt>
84 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
85 <dd>is the handle to the library instance got through ll_cluster_new()
86 '<i><font color="#993399">service</font></i>' is the type of service, which
87 the calling process registers with the heartbeat daemon. </dd>
88 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
89 <dd> This function sets up a communication link with the local heartbeat
90 daemon and registers itself for the '<i><font color="#993399">service</font></i>'
91 service. In the case of casual client the clientid is NULL. But in the case
92 of non-casual client the clientid is non-NULL and it indicates the service
93 to which this client wants to sign on for. This special communication link
94 setup with the heartbeat daemon is a fifo. Non-casual clients interact using
95 a fifo whose name is derived from the pid of the clients process. Casual
96 clients interact with heartbeat daemon using the fifo whose name is derived
97 from the '<i><font color="#993399">service'</font></i>string.
98 <p> The heartbeat daemon has no notion for '<i>s<font
99 color="#993399">ervice</font></i><font color="#993399">'</font>. Only the
100 clients registered with the heartbeat daemons for the same service, have
101 the notion for that service.&nbsp; '<i><font color="#993399">service</font></i>'
102 mostly is a mechanism of providing primitive group services to a set of non-casual
103 clients registered for that service. </p>
104 </dd>
105 <dt><i><font color="#ff0000" size="+1">Return value</font></i>:</dt>
106 <dd> On success returns HA_OK <br>
107 On failure returns HA_FAIL </dd>
108 </dl>
109
110 <h2><a name="signoff()"><font size="+2">signoff()</font></a></h2>
111 <i><font color="#3366ff"><font size="+2">int signoff(struct ll_cluster
112 *cinfo)</font></font></i>
113 <dl>
114 <dt><font color="#ff0000">Parameter Description:</font></dt>
115 <dt><i><font color="#993399">'cinfo' </font></i></dt>
116 <dd>is the handle to the library instance got through ll_cluster_new() </dd>
117 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
118 <dd> This function deletes the communication link with the local heartbeat
119 daemon and unsubscribe itself from being a heartbeat client. </dd>
120 <dt><i><font color="#ff0000">Return Value:</font></i></dt>
121 <dd> On success it returns HA_OK.<br>
122 On failure it returns HA_FAIL. </dd>
123 </dl>
124
125 <h2> <a name="delete()"><font size="+2">delete()</font></a></h2>
126 <br>
127 <i><font color="#3333ff"><font size="+2">int delete(struct ll_cluster *cinfo)</font></font></i>
128
129 <dl>
130 <dt><i><font color="#ff0000"><font size="+1">Parameter Description:</font></font></i></dt>
131 <dt><i><font color="#993399">cinfo</font></i>'</dt>
132 <dd>is the handle to the library instance got through ll_cluster_new() </dd>
133 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
134 <dd> This operation is reverse of ll_cluster_new(). It unsubscribes itself
135 from the heartbeat library and cleans up the corresponding datastructures.
136 </dd>
137 <dt><i><font color="#ff0000"><font size="+1">Return Value:</font></font></i></dt>
138 <dd> On success returns HA_OK <br>
139 On failure returns HA_FAIL </dd>
140 </dl>
141
142 <h2><a name="set_msg_callback()"><font size="+2">set_msg_callback()</font></a></h2>
143 <i><font color="#3366ff"><font size="+2">int set_msg_callback(struct ll_cluster
144 *cinfo,</font></font></i> <i><font color="#3366ff"><font size="+2">&nbsp;
145 const char *msgtype,</font></font></i> <i><font color="#3366ff"><font
146 size="+2">&nbsp; llc_msg_callback_t callback, void * p)</font></font></i>
147 <dl>
148 <dt><i><font color="#ff0000"><font size="+1">Parameter Description:</font></font></i></dt>
149 <dd> <br>
150 </dd>
151 <dt><i><font color="#993399">cinfo</font></i>'</dt>
152 <dd>is the handle to the library instance got through ll_cluster_new() </dd>
153 <dt>'<i><font color="#993399">msgtype'</font></i></dt>
154 <dd> is the type of message on receipt of which the 'callback' is called.
155 </dd>
156 <dt>'<i><font color="#993399">callback</font></i>'</dt>
157 <dd> is the function to be called on receipt of a message of type '<i><font
158 color="#993399">msgtype</font></i>'. </dd>
159 <dt><i><font color="#993399">'p'</font></i> </dt>
160 <dd> is the parameter to be passed to the 'callback' function. </dd>
161 <dt><i><font color="#ff0000"><font size="+1">Description</font></font></i>:</dt>
162 <dd> This function registers a callback function along with its parameter.
163 The callback function is called by the heartbeat library on receipt of a
164 message of type '<i><font color="#993399">msgtype</font></i>' from the heartbeat
165 daemon. </dd>
166 <dt>NOTE:</dt>
167 <dd> Neither the heartbeat library nor heartbeat daemon interpret '<font
168 color="#993399">msgtype'.</font> The '<i><font color="#993399">msgtype'
169 </font></i>is interpreted only by the client.&nbsp; Clients can coin
170 their own msgtype as long as all the clients signed up for the same service
171 can interpret it. </dd>
172 <dt><i><font color="#ff0000" size="+1">Return Value:</font></i></dt>
173 <dd> On success HA_OK is returned. <br>
174 On failure HA_FAIL is returned. </dd>
175 </dl>
176
177 <h2> <a name="set_nstatus_callback()"><font size="+2">set_nstatus_callback()</font></a></h2>
178 <i><font color="#3333ff"><font size="+2">int set_nstatus_callback(struct
179 ll_cluster *cinfo,</font></font></i> <i><font color="#3333ff"><font
180 size="+2"> llc_nstatus_callback_t cbf, void *p)</font></font></i>
181 <dl>
182 <dt> <i><font color="#ff0000"><font size="+1">Parameter Description:</font></font></i></dt>
183 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
184 <dd>is the handle to the library instance got through ll_cluster_new </dd>
185 <dt>'<i><font color="#993399">cbf</font></i>'</dt>
186 <dd> is the function pointer to be called on change of status of any node
187 in the cluster. </dd>
188 <dt>'<i><font color="#993399">p</font></i>'</dt>
189 <dd> is the parameter to be passed to the callback function. </dd>
190 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
191 <dd> This function registers a callback function along with its parameter.
192 The callback function is called by the heartbeat library on change of status
193 of any node in the cluster. </dd>
194 <dt><i><font color="#ff0000"><font size="+1">Return Value:</font></font></i></dt>
195 <dd> On success HA_OK is returned. </dd>
196 <dt> <i><font color="#ff0000"><font size="+1">Observation:</font></font></i></dt>
197 <dd> There is a bug in this function. It does not validate the 'cinfo'
198 parameter'. It should return HA_FAIL on failure. </dd>
199 </dl>
200
201 <h2><a name="set_ifstatus_callback()"><font size="+2">set_ifstatus_callback()</font></a></h2>
202 <i><font color="#3366ff"><font size="+2">int set_ifstatus_callback(struct
203 ll_cluster *cinfo,</font></font></i> <i><font color="#3366ff"><font
204 size="+2"> llc_ifstatus_callback_t cbf, void *p)</font></font></i>
205 <dl>
206 <dt><i><font color="#ff0000" size="+1">Parameter Description:</font></i></dt>
207 <dt> '<font color="#993399">cinfo</font>'</dt>
208 <dd>is the handle to the library instance got through ll_cluster_new() </dd>
209 <dt><i><font color="#993399">cbf'</font></i></dt>
210 <dd> is the function pointer to be called on change of status of any interface
211 in the cluster. </dd>
212 <dt>'<i><font color="#993399">p'</font></i></dt>
213 <dd> is the parameter to be passed for the callback function. </dd>
214 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
215 <dd> This function registers a callback function along with its parameter.
216 The callback function is called by the heartbeat library on change of status
217 of any network interface in the cluster in the view of the current cluster
218 node. </dd>
219 <dt><i><font color="#ff0000"><font size="+1">Return Value:</font></font></i></dt>
220 <dd> On success HA_OK is returned.
221 <p> Also there is a bug in this function. It does not validate the 'cinfo'
222 parameter'. It should return HA_FAIL on failure. </p>
223 </dd>
224 </dl>
225
226 <h2><a name="init_nodewalk()"><font size="+2">init_nodewalk()</font></a></h2>
227 <br>
228 <i><font size="+2" color="#3366ff">int init_nodewalk(struct ll_cluster_t
229 *cinfo)</font></i>
230 <dl>
231 <dt><i><font color="#ff0000" size="+1">Parameter Description:</font></i></dt>
232 <dt><i><font color="#993399">'cinfo' </font></i></dt>
233 <dd>is the handle to the library instance got through ll_cluster_new </dd>
234 <dt><i><font color="#ff0000" size="+1">Description:</font></i> </dt>
235 <dd> This function talks to the heartbeat daemon and retrieves the set
236 of nodes that are part of the cluster. If the retrieval is successful HA_OK
237 is returned. </dd>
238 <dt><font color="#ff6666" size="+1">Return Value:</font></dt>
239 <dd>On success HA_OK is returned <br>
240 On failure HA_FAIL is returned </dd>
241 </dl>
242
243 <h2><a name="nextnode()"><font size="+2">nextnode()</font></a></h2>
244 <i><font color="#3366ff"><font size="+2">char *nextnode(ll_cluster_t *cinfo)</font></font></i>
245 <dl>
246 <dt> <i><font color="#ff0000" size="+1">Parameter Description:</font></i></dt>
247 <dt>'<i><font color="#663366">cinfo'</font></i></dt>
248 <dd>is the handle to the library instance gotten through ll_cluster_new().
249 </dd>
250 <dt><i><font color="#ff0000"><font size="+1">Description/Return Value:</font></font></i>,</dt>
251 <dd> This function returns the next node in the cluster, which is cached
252 in the heartbeat library. If no more node is available it returns NULL. </dd>
253 </dl>
254
255 <h2><a name="end_nodewalk()"><font size="+2">end_nodewalk()</font></a></h2>
256 <br>
257 <i><font size="+2"> <font color="#3366ff">int end_nodewalk(ll_cluster_t *cinfo)</font></font></i>
258 <dl>
259 <dt><i><font color="#ff0000"><font size="+1">Parameter Description:</font></font></i></dt>
260 <dt>'<i><font color="#993399">cinfo'</font></i></dt>
261 <dd>is the handle to the library instance got through ll_cluster_new().
262 </dd>
263 <dt><i><font color="#ff0000">Description:</font></i></dt>
264 <dd> This clears the cluster node information cached in the heartbeat library.
265 </dd>
266 <dt><i><font color="#ff0000"><font size="+1">Return Value:</font></font></i></dt>
267 <dd> returns HA_OK on success&nbsp; and HA_FAIL on failure. </dd>
268 </dl>
269
270 <h2><a name="init_ifwalk()"><font size="+2">init_ifwalk()</font></a></h2>
271 <i><font color="#3366ff"><font size="+2">int init_ifwalk(struct ll_cluster_t
272 *cinfo, char *host)</font></font></i>
273 <dl>
274 <dt><font color="#ff0000"><font size="+1">Parameter Description:</font></font></dt>
275 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
276 <dd> is the handle to the library instance got through ll_cluster_new</dd>
277 <dt>'<i><font color="#993399">host</font></i>'</dt>
278 <dd> is the node in the cluster whose network interfaces are of interest.
279 </dd>
280 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
281 <dd> This function talks to the heartbeat daemon and caches all the network
282 interface information associated with '<i><font color="#993399">host'</font></i>
283 node. This caching is done in the heartbeat library. </dd>
284 <dt><i><font color="#ff0000"><font size="+1">Return Value:</font></font></i></dt>
285 <dd> If the network interface information can be successfully retrieved,
286 HA_OK is returned. Failure returns HA_FAIL. </dd>
287 </dl>
288
289 <h2><a name="nextif(ll_cluster_t *cinfo)"><font size="+2">nextif()</font></a></h2>
290 <font size="+2">&nbsp; <font color="#3366ff">char * nextif(ll_cluster_t
291 *cinfo)</font></font>
292 <dl>
293 <dt><i><font color="#ff0000"><font size="+1">Parameter Description:</font></font></i></dt>
294 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
295 <dd>is the handle to the library instance got through ll_cluster_new().
296 </dd>
297 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i>
298 </dt>
299 <dd> This function returns the next network interface of the '<i><font
300 color="#993399">host</font></i>' node in the cluster, which is cached in
301 the heartbeat library. </dd>
302 <dt>NOTE:</dt>
303 <dd> The '<i><font color="#993399">host</font></i>' is the node of the
304 cluster specified during the call to init_ifwalk() </dd>
305 <dt><i><font color="#ff0000"><font size="+1"> Return Value</font></font></i>:</dt>
306 <dd> If no more interfaces are available it returns NULL. </dd>
307 </dl>
308
309 <h2><a name="end_ifwalk()"><font size="+2">end_ifwalk()</font></a></h2>
310 <br>
311 <i><font size="+2"> <font color="#3366ff">int end_ifwalk(ll_cluster_t *cinfo)</font></font></i>
312 <dl>
313 <dt><i><font color="#ff0000" size="+1">Parameter Description:</font></i></dt>
314 <dt><i><font color="#993399"> 'cinfo' </font></i></dt>
315 <dd>is the handle to the library instance got through ll_cluster_new().
316 </dd>
317 <dt><i><font color="#ff0000"><font size="+1">Description</font></font></i>:</dt>
318 <dd> This clears the network interface information cached in the heartbeat
319 library. </dd>
320 <dt><i><font color="#ff0000"><font size="+1">Return Value:</font></font></i></dt>
321 <dd> returns HA_OK on success and HA_FAIL of failure. </dd>
322 </dl>
323
324 <h2><a name="if_status()"><font size="+2">if_status()</font></a></h2>
325 <i><font color="#3366ff"><font size="+2">char *&nbsp; if_status(ll_cluster_t
326 *cinfo, const char *host,</font></font></i> <br>
327 <i><font color="#3366ff"><font size="+2"> const char *ifname)</font></font></i>
328 <dl>
329 <dt><i><font color="#ff0000" size="+1">Parameter Description:</font></i>
330 </dt>
331 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
332 <dd>is the handle to the library instance got through ll_cluster_new().
333 </dd>
334 <dt>'<i><font color="#993399">host</font></i>'</dt>
335 <dd> is the node name whose interface's status is queried. </dd>
336 <dt>'<i><font color="#993399">ifname'</font></i></dt>
337 is the name of the interface whose status is queried. <dt><i><font
338 color="#ff0000" size="+1">Description:</font></i></dt>
339 <dd> This function returns a string that specifies the state of the interface
340 'ifname' on cluster node 'host' </dd>
341 <dt><i><font color="#ff0000" size="+1">Return Value:</font></i></dt>
342 <dd> It returns "up" if the link is active and "dead" if the link is down.
343 NULL if there was a error. </dd>
344 </dl>
345
346 <h2> <a name="sendclustermsg()"><font size="+2">sendclustermsg()</font></a></h2>
347 <i><font size="+2">int sendclustermsg(ll_cluster_t *cinfo, struct ha_msg*
348 msg)</font></i>
349 <dl>
350 <dt><i><font color="#ff0000" size="+1">Parameter Description:</font></i></dt>
351 <dt>'<i><font color="#993399">cinfo'</font></i> </dt>
352 <dd>is the handle to the library instance got through ll_cluster_new().
353 </dd>
354 <dt>'<i><font color="#993399">msg' </font></i></dt>
355 <dd> is the message to be sent to all non-casual clients signed up for
356 the same service as that of the calling client. </dd>
357 <dt><i><font color="#ff0000" size="+1">Description:</font></i></dt>
358 <dd> This function broadcasts the message to all members of the group. </dd>
359 <dt><i><font size="+1" color="#cc0000">Return Value:</font></i></dt>
360 <dd> This function returns HA_FAIL if called by a casual client or if there
361 was some other failure. <br>
362 On success it returns HA_OK. </dd>
363 </dl>
364
365 <h2> <a name="sendnodemsg()"><font size="+2">sendnodemsg()</font></a></h2>
366 <i><font size="+2"> <font color="#3333ff">int sendnodemsg(ll_cluster_t *cinfo,
367 struct ha_msg* msg,</font></font></i> <br>
368 <i><font color="#3333ff"><font size="+2"> const char *nodename)</font></font></i>
369
370 <dl>
371 <dt><i><font color="#ff0000" size="+1">Parameter Description:</font></i></dt>
372 <dt> '<i><font color="#993399">cinfo</font></i>'</dt>
373 <dd>is the handle to the library instance got through ll_cluster_new().
374 </dd>
375 <dt> <i><font color="#993399"> 'msg</font></i>'</dt>
376 <dd> is the message to be sent to a non-casual client signed on to the
377 same service on node 'nodename'. </dd>
378 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
379 <dd> This function sends the message to a non-casual client residing on
380 node 'nodename'. The client belongs to the same group as that of the calling
381 client. </dd>
382 <dt><i><font color="#ff0000"><font size="+1">Return Value</font></font></i>:</dt>
383 <dd> This function returns HA_FAIL if called by a casual client or if there
384 was some other failure. <br>
385 On success it returns HA_OK. </dd>
386 </dl>
387
388 <h2><a name="inputfd()"><font size="+2">inputfd()</font></a></h2>
389 <i><font size="+2"> <font color="#3366ff">int inputfd(ll_cluster * cinfo)</font></font></i>
390 <dl>
391 <dt><i><font color="#ff0000"><font size="+1"> Parameter Description</font></font></i>:</dt>
392 <dt> '<i><font color="#cc0000">cinfo</font></i>'</dt>
393 <dd>is the handle to the library instance got through ll_cluster_new().
394 </dd>
395 <dd> <br>
396 </dd>
397 <dt><i><font color="#ff0000"><font size="+1"> Description/Return Value:</font></font></i></dt>
398 <dd> returns the file descriptor of the communication link setup with the
399 local heartbeat daemon. <br>
400 On failure it returns -1. </dd>
401 <dt><i><font color="#ff0000"><font size="+1"> Observation:</font></font></i></dt>
402 <dd> This function is needed in order to be able to perform a select function
403 which selects on incoming API messages. It should <i>not</i> be used for
404 any other purpose. </dd>
405 </dl>
406
407 <h2><a name="msgready()"><font size="+2">msgready()</font></a></h2>
408 <i><font size="+2">int msgready(ll_cluster_t *cinfo)</font></i>
409 <dl>
410 <dt><i><font color="#ff0000" size="+1">Parameter Description:</font></i></dt>
411 <dt>'<i><font color="#cc0000">cinfo</font></i>'</dt>
412 <dd>is the handle to the library instance got through ll_cluster_new().
413 </dd>
414 <dt><i><font color="#ff0000" size="+1">Description:</font></i></dt>
415 <dd> checks if there is any message to be read. </dd>
416 <dt><i><font color="#ff0000" size="+1">Return Value:</font></i></dt>
417 <dd> If a message is ready to be read returns non zero value. Otherwise
418 returns 0. </dd>
419 </dl>
420
421 <h2><a name="setmsgsignal()"><font size="+2">setmsgsignal()</font></a></h2>
422 <font color="#3366ff"><i><font size="+2"> int setmsgsignal(ll_cluster_t
423 *cinfo, int nsig)</font></i></font>
424 <dl>
425 <dt><font color="#ff0000"><font size="+1"><i>Parameter Description</i></font></font><i>:</i>
426 </dt>
427 <dt> '<i><font color="#cc0000">cinfo</font></i>'</dt>
428 <dd>is the handle to the library instance got through ll_cluster_new().
429 </dd>
430 <dt> '<i><font color="#cc0000">nsig</font></i>'</dt>
431 <dd> is the signal to be used by heartbeat daemon to signal the client
432 process. </dd>
433 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
434 <dd> This function informs the heartbeat daemon send signal number '<i><font
435 color="#cc0000">nsig</font></i>' whenever a message arrives for it. </dd>
436 <dt><i><font color="#ff0000" size="+1">Return Value:</font></i></dt>
437 <dd> returns HA_OK on success <br>
438 and HA_FAIL on failure </dd>
439 </dl>
440
441 <h2><a name="rcvmsg()"><font size="+2">rcvmsg()</font></a></h2>
442 <font color="#3366ff"><i><font size="+2"> int rcvmsg(ll_cluster_t *cinfo,&nbsp;
443 int blocking)</font></i></font>
444 <dl>
445 <dt><i><font color="#ff0000"><font size="+1"> Parameter Description:</font></font></i></dt>
446 <dt>'<i><font color="#cc0000">cinfo</font></i>'</dt>
447 <dd>is the handle to the library instance got through ll_cluster_new().
448 </dd>
449 <dt>'<i><font color="#cc0000">blocking'</font></i> </dt>
450 <dd> indicates whether to block for the receipt of a message or not. </dd>
451 <dt><i><font color="#ff0000"><font size="+1">Description/Return Value:</font></font></i></dt>
452 <dd> This function returns true if a message for which a callback function
453 was not registered is received.
454 <p> If blocking is set, then it waits till a message arrives. But it
455 returns true only if that message does not have a callback registered. </p>
456 </dd>
457 <dt>NOTE:</dt>
458 <dd>In all cases, received messages are deleted by this call. </dd>
459 <dt><font color="#ff0000" size="+1"><i>Observation:</i></font></dt>
460 <dd> This interface is provided as a convenience to allow for clients which
461 only process certain message types through registered callback functions to
462 never have to worry about the possibility of failing to destroy their messages.
463 If you process all messages you handle with callbacks, then this function
464 is a convenient choice. Otherwise, you likely need to use readmsg(). </dd>
465 </dl>
466
467 <h2> <a name="readmsg()"><font size="+2">readmsg()</font></a></h2>
468 <br>
469 <font color="#3366ff"><i><font size="+2">struct ha_msg * readmsg(ll_cluster_t
470 *cinfo, int blocking)</font></i></font>
471 <dl>
472 <dt><font color="#ff0000"><font size="+1"> Parameter Description:</font></font></dt>
473 <dt> '<i><font color="#993399">cinfo</font></i>' </dt>
474 <dd>is the handle to the library instance got through ll_cluster_new().
475 </dd>
476 <dt>'<i><font color="#993399">blocking'</font></i></dt>
477 <dd> indicates whether to block for the receipt of a message or not. </dd>
478 <dt><b><i><font color="#ff0000"><font size="+1">Description/Return Value:</font></font></i></b></dt>
479 <dd> This function is same as rcvmsg except that it returns messages without
480 registered callbacks to the caller (and does not delete them). It returns
481 the next message for which a callback is not registered.
482 <p> If '<i><font color="#993399">blocking'</font></i> is set to FALSE,
483 it will not wait for a message to arrive. It returns NULL if there is not
484 currently a message ready to read which is not intercepted by a callback
485 function. </p>
486 </dd>
487 <dt>NOTE:</dt>
488 <dd>The message returned must be disposed off by the caller by calling
489 ha_msg_del(). </dd>
490 </dl>
491
492 <h2><a name="setfmode()"><font size="+2">setfmode()</font></a></h2>
493 <br>
494 <font color="#3366ff"> <i><font size="+2">int setfmode(ll_cluster_t *cinfo,
495 int mode)</font></i></font>
496 <dl>
497 <dt><i> <font color="#ff0000" size="+1">Parameter Description:</font></i></dt>
498 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
499 <dd>is the handle to the library instance got through ll_cluster_new().
500 </dd>
501 <dt>'<i><font color="#993399">mode</font></i>'</dt>
502 <dd> indicates the type of messages to be delivered to the client and to
503 filter out the rest.
504 <p> The modes have the following meanings: </p>
505 </dd>
506 <dl>
507 <dt><b>LLC_FILTER_DEFAULT</b></dt>
508 <dd> All messages destined to this client are received, along with
509 all that are addressed to all clients. </dd>
510 <dt><b>LLC_FILTER_PMODE</b></dt>
511 <dd>All messages, but filter out heartbeats that don't tell us anything
512 new. </dd>
513 <dt><b>LLC_FILTER_ALLHB</b></dt>
514 <dd> All heartbeats including those that don't change status. </dd>
515 <dt><b>LLC_FILTER_RAW</b></dt>
516 <dd> All packets from all interfaces, even duplicates. Packets with
517 authentication errors are still ignored. </dd>
518 </dl>
519 <dt><i><font color="#ff0000"><font size="+1"> Description:</font></font></i></dt>
520 <dd> This function sets up the type of messages that the client is interested;
521 to be received from the local heartbeat daemon. It is mainly used for debugging.
522 </dd>
523 <dt> <i><font color="#ff0000"><font size="+1">Return Value:</font></font></i>
524 </dt>
525 <dd> returns HA_OK on success and HA_FAIL on failure</dd>
526 <dd><br>
527 </dd>
528 </dl>
529 <b><a name="get_parameter"><font size="+2">get_parameter()</font></a></b>
530 <dl>
531 <dd> <i><font color="#3366ff"><font size="+2">char* get_parameter(struct
532 ll_cluster_t * cinfo, char *pname)</font></font></i> </dd>
533 <dt><font color="#ff0000"><font size="+1">Parameter Description:</font></font></dt>
534 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
535 <dd> is the handle to the library instance got through ll_cluster_new</dd>
536 <dt>'<i><font color="#993399">pname</font></i>'</dt>
537 <dd>is the name of the parameter to retrieve </dd>
538 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
539 <dd> This function retrieves the value of the named parameter from heartbeat.
540 The parameters supported are listed in &lt;hb_api.h&gt;. </dd>
541 <dt><i><font color="#ff0000"><font size="+1">Return Value:</font></font></i></dt>
542 <dd> If the network interface information can be successfully retrieved,
543 a pointer to a malloced string is returned. NULL is returned on failure.
544 &nbsp;This value is malloced, and the caller must free the return value is
545 no longer needed.</dd>
546
547 </dl>
548 <b><a name="get_deadtime"><font size="+2">get_deadtime()</font></a></b>
549 <dl>
550 <dd> <i><font color="#3366ff"><font size="+2">long get_deadtime(struct
551 ll_cluster_t * cinfo)</font></font></i> </dd>
552 <dt><font color="#ff0000"><font size="+1">Parameter Description:</font></font></dt>
553 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
554 <dd> is the handle to the library instance got through ll_cluster_new</dd>
555 <dd> </dd>
556 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
557 <dd> This function retrieves the deadtime value from heartbeat. &nbsp;The
558 value returned is in milliseconds. </dd>
559 <dt><i><font color="#ff0000"><font size="+1">Return Value:</font></font></i></dt>
560 <dd>The return value is the deadtime, measured in milliseconds. </dd>
561 </dl>
562 <b><a name="get_keepalive"><font size="+2">get_keepalive()</font></a></b>
563 <dl>
564 <dd> <i><font color="#3366ff"><font size="+2">long get_keepalive(struct
565 ll_cluster_t * cinfo)</font></font></i> </dd>
566 <dt><font color="#ff0000"><font size="+1">Parameter Description:</font></font></dt>
567 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
568 <dd> is the handle to the library instance got through ll_cluster_new().</dd>
569 <dd> <br>
570 </dd>
571 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
572 <dd> This function retrieves the keepalive value from heartbeat. &nbsp;The
573 value returned is in milliseconds. </dd>
574 <dt><i><font color="#ff0000"><font size="+1">Return Value:</font></font></i></dt>
575 <dd>The return value is the keepalive interval, measured in milliseconds.</dd>
576 </dl>
577 <h2><a name="get_mynodeid"><b><font size="+2">get_mynodeid()</font></b></a></h2>
578 <i><font color="#3366ff" size="+2">const char * get_mynodeid(ll_cluster_t
579 *cinfo)</font></i>
580 <dl>
581 <dt><i><font size="+1" color="#cc0000">Parameter Description:</font></i></dt>
582 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
583 <dd>is the handle to the library instance got through ll_cluster_new</dd>
584 <dt><i><font color="#ff0000" size="+1"> Description/Return Value:</font></i></dt>
585 <dd> This function returns the node id of the current cluster node. &nbsp;It
586 is generally (though not always) the same as the uname -n name of the current
587 server. &nbsp;The return value is a static value. </dd>
588 </dl>
589 <br>
590 <b><a name="get_logfacility"><font size="+2">get_logfacility()</font></a></b>
591 <dl>
592 <dd> <i><font color="#3366ff"><font size="+2">long get_logfacility(struct
593 ll_cluster_t * cinfo)</font></font></i> </dd>
594 <dt><font color="#ff0000"><font size="+1">Parameter Description:</font></font></dt>
595 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
596 <dd> is the handle to the library instance got through ll_cluster_new().</dd>
597 <dd> <br>
598 </dd>
599 <dt><i><font color="#ff0000"><font size="+1">Description:</font></font></i></dt>
600 <dd> This function retrieves the logfacility value from heartbeat. &nbsp;
601 </dd>
602 <dt><i><font color="#ff0000"><font size="+1">Return Value:</font></font></i></dt>
603 <dd>The return value is the logfacility currently being used by heartbeat.
604 &nbsp;If there is no log facility being used by heartbeat, then it will return
605 -1. </dd>
606 </dl>
607 <h2><a name="get_resources"><b><font size="+2">get_resources()</font></b></a></h2>
608 <i><font color="#3366ff" size="+2">const char * get_resources(ll_cluster_t
609 *cinfo)</font></i>
610 <dl>
611 <dt><i><font size="+1" color="#cc0000">Parameter Description:</font></i></dt>
612 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
613 <dd>is the handle to the library instance got through ll_cluster_new</dd>
614 <dt><i><font color="#ff0000" size="+1"> Description/Return Value:</font></i></dt>
615 <dd> This function returns the current resource allocation as supported
616 by the current resource management function. &nbsp;The return value is a
617 static string containing one of "local", "foreign", "all", "none" or "transition"..
618 &nbsp;"local" means the local nodes is supporting only local resources. &nbsp;"foreign"
619 means the local node is supporting only foreign resources (those belonging
620 to the other node). &nbsp;"all" means the local node is supporting all cluster
621 resources. &nbsp;"none" means the local node is not providing any cluster
622 resources. &nbsp;"transition" means that resources are currently in transition.&nbsp;
623 &nbsp;If heartbeat is not providing resource management, the return value
624 will be <b><big><tt>NULL</tt></big></b>. </dd>
625 </dl>
626 <br>
627
628 <h2><a name="errmsg()"><b><font size="+2">errmsg()</font></b></a></h2>
629 <i><font color="#3366ff" size="+2">const char * errmsg(ll_cluster_t *cinfo)</font></i>
630
631 <dl>
632 <dt><i><font size="+1" color="#cc0000">Parameter Description:</font></i></dt>
633 <dt>'<i><font color="#993399">cinfo</font></i>'</dt>
634 <dd>is the handle to the library instance got through ll_cluster_new</dd>
635 <dt><i><font color="#ff0000" size="+1"> Description/Return Value:</font></i></dt>
636 <dd> This function returns the last set of error messages from the previous
637 API call. This is not a very wonderful interface (according to alanr) </dd>
638 </dl>
639 <br>
640 </body>
641 </html>