2011-11-11 12:41:24 +11:00
# ifndef _CTDB_INCLUDES_H
# define _CTDB_INCLUDES_H
2006-11-18 10:41:20 +11:00
# define HAVE_UNIXSOCKET 1
# include "replace.h"
# include "talloc.h"
2008-01-05 17:42:01 +11:00
# include "system/wait.h"
2009-01-28 17:40:24 +01:00
# include "system/network.h"
2006-11-18 10:41:20 +11:00
# include "tdb.h"
2006-11-28 20:48:34 +11:00
# include "idtree.h"
2010-05-20 15:18:30 +09:30
# include "ctdb_client.h"
2006-11-18 10:41:20 +11:00
2012-04-13 16:46:38 +10:00
/* Allow use of deprecated function tevent_loop_allow_nesting() */
# define TEVENT_DEPRECATED
/* Saves ctdb from massive churn. */
# define TEVENT_COMPAT_DEFINES 1
# include "tevent.h"
2007-04-17 22:13:06 +10:00
extern int LogLevel ;
2008-02-04 17:44:24 +11:00
extern int this_log_level ;
enum debug_level {
DEBUG_EMERG = - 3 ,
DEBUG_ALERT = - 2 ,
DEBUG_CRIT = - 1 ,
DEBUG_ERR = 0 ,
DEBUG_WARNING = 1 ,
DEBUG_NOTICE = 2 ,
DEBUG_INFO = 3 ,
DEBUG_DEBUG = 4 ,
} ;
2009-12-19 11:40:06 +01:00
# define DEBUGLVL(lvl) ((lvl) <= LogLevel)
2009-12-04 11:45:37 +11:00
# define DEBUG(lvl, x) do { this_log_level = (lvl); if ((lvl) < DEBUG_DEBUG) { log_ringbuffer x; } if ((lvl) <= LogLevel) { do_debug x; }} while (0)
2009-12-19 11:40:06 +01:00
# define DEBUGADD(lvl, x) do { if ((lvl) <= LogLevel) { this_log_level = (lvl); do_debug_add x; }} while (0)
2006-11-18 10:41:20 +11:00
# define _PUBLIC_
2009-12-18 12:32:38 +01:00
# define _NORETURN_
# define _PURE_
2006-11-18 10:41:20 +11:00
# define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
2007-04-04 15:02:49 +10:00
# ifndef discard_const
# define discard_const(ptr) ((void *)((intptr_t)(ptr)))
# endif
2006-11-18 10:41:20 +11:00
struct timeval timeval_zero ( void ) ;
bool timeval_is_zero ( const struct timeval * tv ) ;
struct timeval timeval_current ( void ) ;
struct timeval timeval_set ( uint32_t secs , uint32_t usecs ) ;
int timeval_compare ( const struct timeval * tv1 , const struct timeval * tv2 ) ;
struct timeval timeval_until ( const struct timeval * tv1 ,
const struct timeval * tv2 ) ;
_PUBLIC_ struct timeval timeval_current_ofs ( uint32_t secs , uint32_t usecs ) ;
2007-04-16 16:01:37 +10:00
double timeval_elapsed ( struct timeval * tv ) ;
2008-07-02 13:55:59 +10:00
double timeval_delta ( struct timeval * tv2 , struct timeval * tv ) ;
2006-11-18 10:41:20 +11:00
char * * file_lines_load ( const char * fname , int * numlines , TALLOC_CTX * mem_ctx ) ;
2007-07-10 18:13:47 +10:00
char * hex_encode_talloc ( TALLOC_CTX * mem_ctx , const unsigned char * buff_in , size_t len ) ;
2013-03-13 22:57:44 +11:00
uint8_t * hex_decode_talloc ( TALLOC_CTX * mem_ctx , const char * hex_in , size_t * len ) ;
2007-05-02 07:32:04 +10:00
_PUBLIC_ const char * * str_list_add ( const char * * list , const char * s ) ;
2012-05-17 16:08:37 +10:00
_PUBLIC_ int set_blocking ( int fd , bool set ) ;
2007-04-22 09:24:27 +02:00
2009-12-18 12:32:38 +01:00
# include "lib/util/debug.h"
# include "lib/util/util.h"
2011-11-11 12:41:24 +11:00
# endif /* _CTDB_INCLUDES_H */