1 /* -*-pgsql-c-*- */ 2 /* 3 * 4 * $Header$ 5 * 6 * pgpool: a language independent connection pool server for PostgreSQL 7 * written by Tatsuo Ishii 8 * 9 * Copyright (c) 2003-2018 PgPool Global Development Group 10 * 11 * Permission to use, copy, modify, and distribute this software and 12 * its documentation for any purpose and without fee is hereby 13 * granted, provided that the above copyright notice appear in all 14 * copies and that both that copyright notice and this permission 15 * notice appear in supporting documentation, and that the name of the 16 * author not be used in advertising or publicity pertaining to 17 * distribution of the software without specific, written prior 18 * permission. The author makes no representations about the 19 * suitability of this software for any purpose. It is provided "as 20 * is" without express or implied warranty. 21 * 22 * 23 */ 24 25 #ifndef WD_UTILS_H 26 #define WD_UTILS_H 27 28 #include <ifaddrs.h> 29 #include "parser/pg_list.h" 30 31 #define WD_NG (0) 32 #define WD_OK (1) 33 #define WD_MAX_PACKET_STRING (256) 34 35 /* wd_utils.c*/ 36 extern int wd_chk_sticky(void); 37 extern void wd_check_network_command_configurations(void); 38 extern int watchdog_thread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg); 39 extern char *string_replace(const char *string, const char *pattern, const char *replacement); 40 extern void wd_calc_hash(const char *str, int len, char *buf); 41 extern int aes_decrypt_with_password(unsigned char *ciphertext, int ciphertext_len, 42 const char *password, unsigned char *plaintext); 43 extern int aes_encrypt_with_password(unsigned char *plaintext, int plaintext_len, 44 const char *password, unsigned char *ciphertext); 45 46 /* wd_escalation.c */ 47 extern pid_t fork_escalation_process(void); 48 extern pid_t fork_plunging_process(void); 49 50 /* wd_ping.c */ 51 extern int wd_is_upper_ok(char *server_list); 52 extern bool wd_is_ip_exists(char *ip); 53 extern bool wd_get_ping_result(char *hostname, int exit_status, int outfd); 54 extern pid_t wd_issue_ping_command(char *hostname, int *outfd); 55 56 /* wd_if.c */ 57 extern List *get_all_local_ips(void); 58 extern int wd_IP_up(void); 59 extern int wd_IP_down(void); 60 extern char *wd_get_cmd(char *cmd); 61 extern int create_monitoring_socket(void); 62 extern bool read_interface_change_event(int sock, bool *link_event, bool *deleted); 63 extern bool is_interface_up(struct ifaddrs *ifa); 64 65 #endif 66