00001 /*************************************************************************** 00002 BSD License 00003 00004 Copyright (c) 2002, Intel Corporation 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without 00008 modification, are permitted provided that the following conditions are met: 00009 00010 a.. Redistributions of source code must retain the above copyright notice, 00011 this list of conditions and the following disclaimer. 00012 b.. Redistributions in binary form must reproduce the above copyright notice, 00013 this list of conditions and the following disclaimer in the documentation 00014 and/or other materials provided with the distribution. 00015 c.. Neither the name of Intel Corporation nor the names of its contributors 00016 may be used to endorse or promote products derived from this software 00017 without specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00022 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 00023 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00024 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00025 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00026 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00027 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 00030 ****************************************************************************/ 00031 00032 #ifndef __APPHBMONITOR_H__ 00033 #define __APPHBMONITOR_H__ 00034 00035 #define STRING_LENGTH 256 00036 #define FILE_LINE_LENGTH 256 00037 00038 /** This value determines when registration is considered a failure */ 00039 #define REGISTRATION_TIMEOUT 3 00040 00041 /** The heartbeat structure used to write a heartbeat to the 00042 FIFO. */ 00043 struct ping_data 00044 { 00045 long data; 00046 time_t timestamp; 00047 }; 00048 00049 /** public function prototypes */ 00050 00051 extern int ahm_initialize(const char *a_fifoname, 00052 int *a_fifo_fd, 00053 void **a_reginfo); 00054 extern int ahm_shutdown(void **a_client_reg_info); 00055 int ahm_register(pid_t a_pid, 00056 unsigned long a_id, 00057 const char *a_recovery_script, 00058 const char *a_process_name, 00059 unsigned long a_min_interval, 00060 unsigned long a_max_interval, 00061 void **a_client_reg_info); 00062 int ahm_unregister(void **a_client_reg_info); 00063 int ahm_send_heartbeat(void); 00064 int ahm_add_heartbeat_timer_callback(const void *a_client_reg_info); 00065 int ahm_remove_heartbeat_timer_callback(void); 00066 00067 int ahm_send_heartbeat(void); 00068 int ahm_send_heartbeat_to_fifo(int a_fifo_fd); 00069 00070 00071 #endif /* __APPHBMONITOR_H__ */ 00072