merge latest versions of lib/replace, lib/talloc, lib/tdb and lib/events into ctdb...
[sahlberg/ctdb.git] / include / includes.h
1 #define HAVE_UNIXSOCKET 1
2
3 #include "replace.h"
4 #include "talloc.h"
5 #include "tdb.h"
6 #include "idtree.h"
7 #include "ctdb.h"
8 #include "lib/util/dlinklist.h"
9 #include "lib/util/debug.h"
10
11 typedef bool BOOL;
12
13 #define True 1
14 #define False 0
15
16 extern int LogLevel;
17
18 #define DEBUG(lvl, x) if ((lvl) <= LogLevel) (do_debug x)
19
20 #define _PUBLIC_
21
22 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
23
24 #ifndef discard_const
25 #define discard_const(ptr) ((void *)((intptr_t)(ptr)))
26 #endif
27
28 struct timeval timeval_zero(void);
29 bool timeval_is_zero(const struct timeval *tv);
30 struct timeval timeval_current(void);
31 struct timeval timeval_set(uint32_t secs, uint32_t usecs);
32 int timeval_compare(const struct timeval *tv1, const struct timeval *tv2);
33 struct timeval timeval_until(const struct timeval *tv1,
34                              const struct timeval *tv2);
35 _PUBLIC_ struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs);
36 double timeval_elapsed(struct timeval *tv);
37 char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx);
38 char *hex_encode(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len);
39 _PUBLIC_ const char **str_list_add(const char **list, const char *s);
40 _PUBLIC_ int set_blocking(int fd, BOOL set);
41