sam.h
Go to the documentation of this file.
/*
* Copyright (c) 2009-2011 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Jan Friesse (jfriesse@redhat.com)
*
* This software licensed under BSD license, the text of which follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the Red Hat, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef COROSYNC_SAM_H_DEFINED
#define COROSYNC_SAM_H_DEFINED
#include <corosync/corotypes.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
SAM_RECOVERY_POLICY_QUIT = 1,
SAM_RECOVERY_POLICY_RESTART = 2,
SAM_RECOVERY_POLICY_QUORUM = 0x08,
SAM_RECOVERY_POLICY_QUORUM_QUIT = SAM_RECOVERY_POLICY_QUORUM | SAM_RECOVERY_POLICY_QUIT,
SAM_RECOVERY_POLICY_QUORUM_RESTART = SAM_RECOVERY_POLICY_QUORUM | SAM_RECOVERY_POLICY_RESTART,
SAM_RECOVERY_POLICY_CMAP = 0x10,
SAM_RECOVERY_POLICY_CONFDB = 0x10,
} sam_recovery_policy_t;
typedef int (*sam_hc_callback_t)(void);
cs_error_t sam_initialize (
int time_interval,
sam_recovery_policy_t recovery_policy);
cs_error_t sam_finalize (void);
cs_error_t sam_start (void);
cs_error_t sam_stop (void);
cs_error_t sam_warn_signal_set (int warn_signal);
cs_error_t sam_register (
unsigned int *instance_id);
cs_error_t sam_hc_send (void);
cs_error_t sam_hc_callback_register (sam_hc_callback_t cb);
cs_error_t sam_data_getsize (size_t *size);
cs_error_t sam_data_restore (
void *data,
size_t size);
cs_error_t sam_data_store (
const void *data,
size_t size);
cs_error_t sam_mark_failed (void);
#ifdef __cplusplus
}
#endif
#endif /* COROSYNC_SAM_H_DEFINED */
corotypes.h
cs_error_t
cs_error_t
The cs_error_t enum.
Definition corotypes.h:98
time_interval
int time_interval
Definition sam.c:112
instance_id
unsigned int instance_id
Definition sam.c:115
recovery_policy
sam_recovery_policy_t recovery_policy
Definition sam.c:113
warn_signal
int warn_signal
Definition sam.c:119
sam_warn_signal_set
cs_error_t sam_warn_signal_set(int warn_signal)
Set warning signal to be sent.
Definition sam.c:833
sam_finalize
cs_error_t sam_finalize(void)
Close the SAM handle.
Definition sam.c:724
sam_hc_callback_register
cs_error_t sam_hc_callback_register(sam_hc_callback_t cb)
Register healtcheck callback.
Definition sam.c:1462
sam_data_store
cs_error_t sam_data_store(const void *data, size_t size)
Store user data.
Definition sam.c:586
sam_recovery_policy_t
sam_recovery_policy_t
sam_recovery_policy_t enum
Definition sam.h:46
SAM_RECOVERY_POLICY_CMAP
@ SAM_RECOVERY_POLICY_CMAP
Definition sam.h:52
SAM_RECOVERY_POLICY_QUORUM_RESTART
@ SAM_RECOVERY_POLICY_QUORUM_RESTART
Definition sam.h:51
SAM_RECOVERY_POLICY_QUORUM
@ SAM_RECOVERY_POLICY_QUORUM
Definition sam.h:49
SAM_RECOVERY_POLICY_QUORUM_QUIT
@ SAM_RECOVERY_POLICY_QUORUM_QUIT
Definition sam.h:50
SAM_RECOVERY_POLICY_QUIT
@ SAM_RECOVERY_POLICY_QUIT
Definition sam.h:47
SAM_RECOVERY_POLICY_CONFDB
@ SAM_RECOVERY_POLICY_CONFDB
Definition sam.h:53
SAM_RECOVERY_POLICY_RESTART
@ SAM_RECOVERY_POLICY_RESTART
Definition sam.h:48
sam_mark_failed
cs_error_t sam_mark_failed(void)
Marks child as failed.
Definition sam.c:759
sam_data_restore
cs_error_t sam_data_restore(void *data, size_t size)
Return stored data.
Definition sam.c:469
sam_register
cs_error_t sam_register(unsigned int *instance_id)
Register application.
Definition sam.c:1259
sam_data_getsize
cs_error_t sam_data_getsize(size_t *size)
Return size of stored data.
Definition sam.c:440
sam_stop
cs_error_t sam_stop(void)
Stop healthchecking.
Definition sam.c:684
sam_initialize
cs_error_t sam_initialize(int time_interval, sam_recovery_policy_t recovery_policy)
Create a new SAM connection.
Definition sam.c:276
sam_hc_send
cs_error_t sam_hc_send(void)
Send healthcheck confirmation.
Definition sam.c:697
sam_hc_callback_t
int(* sam_hc_callback_t)(void)
Callback definition for event driven checking.
Definition sam.h:59
sam_start
cs_error_t sam_start(void)
Start healthchecking.
Definition sam.c:601