2 CTDB protocol marshalling
4 Copyright (C) Amitay Isaacs 2015
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 #ifndef __CTDB_PROTOCOL_UTIL_H__
21 #define __CTDB_PROTOCOL_UTIL_H__
25 #include "protocol/protocol.h"
27 const char *ctdb_runstate_to_string(enum ctdb_runstate runstate);
28 enum ctdb_runstate ctdb_runstate_from_string(const char *runstate_str);
30 const char *ctdb_event_to_string(enum ctdb_event event);
31 enum ctdb_event ctdb_event_from_string(const char *event_str);
34 * buflen must be long enough to hold the longest possible address.
35 * For example, 1122:3344:5566:7788:99aa:bbcc:ddee:ff00.
36 * 64 is sane value for buflen.
38 int ctdb_sock_addr_to_buf(char *buf, socklen_t buflen, ctdb_sock_addr *addr);
39 const char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx, ctdb_sock_addr *addr);
40 unsigned int ctdb_sock_addr_port(ctdb_sock_addr *addr);
41 void ctdb_sock_addr_set_port(ctdb_sock_addr *addr, unsigned int port);
42 int ctdb_sock_addr_cmp_ip(const ctdb_sock_addr *addr1,
43 const ctdb_sock_addr *addr2);
44 int ctdb_sock_addr_cmp(const ctdb_sock_addr *addr1,
45 const ctdb_sock_addr *addr2);
46 bool ctdb_sock_addr_same_ip(const ctdb_sock_addr *addr1,
47 const ctdb_sock_addr *addr2);
48 bool ctdb_sock_addr_same(const ctdb_sock_addr *addr1,
49 const ctdb_sock_addr *addr2);
51 #endif /* __CTDB_PROTOCOL_UTIL_H__ */