8ca2bc19b601f752896720e63132e19e6f75ffd2
[citadel.git] / citadel / sysdep_decls.h
1
2 #ifndef SYSDEP_DECLS_H
3 #define SYSDEP_DECLS_H
4
5 #include <stdarg.h>
6 #include "sysdep.h"
7
8 #ifdef HAVE_PTHREAD_H
9 #include <pthread.h>
10 #endif
11
12 #ifdef HAVE_DB_H
13 #include <db.h>
14 #elif defined(HAVE_DB4_DB_H)
15 #include <db4/db.h>
16 #else
17 #error Neither <db.h> nor <db4/db.h> was found by configure. Install db4-devel.
18 #endif
19
20
21 #if DB_VERSION_MAJOR < 4 || DB_VERSION_MINOR < 1
22 #error Citadel requires Berkeley DB v4.1 or newer.  Please upgrade.
23 #endif
24
25 #include "server.h"
26 #include "database.h"
27
28 #if SIZEOF_SIZE_T == SIZEOF_INT 
29 #define SIZE_T_FMT "%d"
30 #else
31 #define SIZE_T_FMT "%ld"
32 #endif
33
34 #if SIZEOF_LOFF_T == SIZEOF_LONG 
35 #define LOFF_T_FMT "%ld"
36 #else
37 #define LOFF_T_FMT "%lld"
38 #endif
39
40 void cputbuf(const StrBuf *Buf);
41
42 #ifdef __GNUC__
43 void cprintf (const char *format, ...) __attribute__((__format__(__printf__,1,2)));
44 #else
45 void cprintf (const char *format, ...);
46 #endif
47
48 void init_sysdep (void);
49 int ctdl_tcp_server(char *ip_addr, int port_number, int queue_len, char *errormessage);
50 int ctdl_uds_server(char *sockpath, int queue_len, char *errormessage);
51 void buffer_output(void);
52 void unbuffer_output(void);
53 void flush_output(void);
54 int client_write (const char *buf, int nbytes);
55 int client_read_to (char *buf, int bytes, int timeout);
56 int client_read (char *buf, int bytes);
57 int client_getln (char *buf, int maxbytes);
58 int CtdlClientGetLine(StrBuf *Target);
59 int client_read_blob(StrBuf *Target, int bytes, int timeout);
60 void client_set_inbound_buf(long N);
61 int client_read_random_blob(StrBuf *Target, int timeout);
62 void client_close(void);
63 void sysdep_master_cleanup (void);
64 void kill_session (int session_to_kill);
65 void start_daemon (int do_close_stdio);
66 void checkcrash(void);
67 int convert_login (char *NameToConvert);
68 void init_master_fdset(void);
69 void *worker_thread(void *);
70
71 extern volatile int exit_signal;
72 extern volatile int shutdown_and_halt;
73 extern volatile int running_as_daemon;
74 extern volatile int restart_server;
75
76 extern int verbosity;
77 extern int rescan[];
78
79
80 extern int SyslogFacility(char *name);
81
82 #endif /* SYSDEP_DECLS_H */