Merge tag 'samba-4.9.9' into v4-9-test
[Samba.git] / ctdb / event / event_protocol_util.c
blobcc59615ecf52a8992d11fbead91d0827985d0ba6
1 /*
2 CTDB event daemon - protocol utilities
4 Copyright (C) Amitay Isaacs 2018
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include "replace.h"
22 #include "event/event_protocol.h"
23 #include "event/event_protocol_api.h"
25 static struct {
26 enum ctdb_event_command command;
27 const char *label;
28 } event_command_map[] = {
29 { CTDB_EVENT_CMD_RUN, "RUN" },
30 { CTDB_EVENT_CMD_STATUS, "STATUS" },
31 { CTDB_EVENT_CMD_SCRIPT, "SCRIPT" },
32 { CTDB_EVENT_CMD_MAX, NULL },
35 const char *ctdb_event_command_to_string(enum ctdb_event_command command)
37 int i;
39 for (i=0; event_command_map[i].label != NULL; i++) {
40 if (event_command_map[i].command == command) {
41 return event_command_map[i].label;
45 return "UNKNOWN";