summaryrefslogtreecommitdiff
path: root/src/include/watchdog/wd_commands.h
blob: 61326137de98f397af489422a3a160e7de6ced88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

/* -*-pgsql-c-*- */
/*
 *
 * $Header$
 *
 * pgpool: a language independent connection pool server for PostgreSQL
 * written by Tatsuo Ishii
 *
 * Copyright (c) 2003-2020	PgPool Global Development Group
 *
 * Permission to use, copy, modify, and distribute this software and
 * its documentation for any purpose and without fee is hereby
 * granted, provided that the above copyright notice appear in all
 * copies and that both that copyright notice and this permission
 * notice appear in supporting documentation, and that the name of the
 * author not be used in advertising or publicity pertaining to
 * distribution of the software without specific, written prior
 * permission. The author makes no representations about the
 * suitability of this software for any purpose.  It is provided "as
 * is" without express or implied warranty.
 *
 *
 */

#ifndef WD_COMMANDS_H
#define WD_COMMANDS_H

#include "watchdog/wd_ipc_defines.h"
#include "watchdog/wd_ipc_conn.h"

typedef struct WDNodeInfo
{
	int			state;
	int			membership_status;
	char		membership_status_string[WD_MAX_HOST_NAMELEN];
	char		nodeName[WD_MAX_HOST_NAMELEN];
	char		hostName[WD_MAX_HOST_NAMELEN];	/* host name */
	char		stateName[WD_MAX_HOST_NAMELEN]; /* watchdog state name */
	int			wd_port;		/* watchdog port */
	int			pgpool_port;	/* pgpool port */
	int			wd_priority;	/* node priority */
	char		delegate_ip[WD_MAX_HOST_NAMELEN];	/* delegate IP */
	int			id;
} WDNodeInfo;

typedef struct WDGenericData
{
	WDValueDataType valueType;
	union data
	{
		char	   *stringVal;
		int			intVal;
		bool		boolVal;
		long		longVal;
	}			data;
} WDGenericData;



extern WDGenericData *get_wd_runtime_variable_value(char *wd_authkey, char *varName);
extern WD_STATES get_watchdog_local_node_state(char *wd_authkey);
extern int	get_watchdog_quorum_state(char *wd_authkey);
extern char *wd_get_watchdog_nodes_json(char *wd_authkey, int nodeID);
extern void set_wd_command_timeout(int sec);
extern char *get_request_json(char *key, char *value, char *authKey);
extern WDNodeInfo *parse_watchdog_node_info_from_wd_node_json(json_value *source);
#endif							/* WD_COMMANDS_H */