* Use syslog-compatible logging levels in lprintf(); the loglevel chosen
[citadel.git] / citadel / sysdep_decls.h
1 /* $Id$ */
2
3 #include <pthread.h>
4 #include "sysdep.h"
5 #include "server.h"
6
7 /* Logging levels - correspond to syslog(3) */
8 enum LogLevel {
9         /* When about to exit the server for an unrecoverable error */
10          CTDL_EMERG,    /* system is unusable */
11         /* Manual intervention is required to avoid an abnormal exit */
12          CTDL_ALERT,    /* action must be taken immediately */
13         /* The server can continue to run with degraded functionality */
14          CTDL_CRIT,     /* critical conditions */
15         /* An error occurs but the server continues to run normally */
16          CTDL_ERR,      /* error conditions */
17         /* An abnormal condition was detected; server will continue normally */
18          CTDL_WARNING,  /* warning conditions */
19         /* Normal messages (login/out, activity, etc.) */
20          CTDL_NOTICE,   /* normal but significant condition */
21         /* Unimportant progress messages, etc. */
22          CTDL_INFO,     /* informational */
23         /* Debugging messages */
24          CTDL_DEBUG,    /* debug-level messages */
25 };
26
27 #ifdef __GNUC__
28 void lprintf (enum LogLevel loglevel, const char *format, ...) __attribute__((__format__(__printf__,2,3)));
29 void cprintf (const char *format, ...) __attribute__((__format__(__printf__,1,2)));
30 #else
31 void lprintf (enum LogLevel loglevel, const char *format, ...);
32 void cprintf (const char *format, ...);
33 #endif
34
35 void init_sysdep (void);
36 void begin_critical_section (int which_one);
37 void end_critical_section (int which_one);
38 int ig_tcp_server (int port_number, int queue_len);
39 int ig_uds_server(char *sockpath, int queue_len);
40 INLINE struct CitContext *MyContext (void);
41 struct CitContext *CreateNewContext (void);
42 void InitMyContext (struct CitContext *con);
43 void buffer_output(void);
44 void unbuffer_output(void);
45 void client_write (char *buf, int nbytes);
46 int client_read_to (char *buf, int bytes, int timeout);
47 int client_read (char *buf, int bytes);
48 int client_gets (char *buf);
49 void sysdep_master_cleanup (void);
50 void kill_session (int session_to_kill);
51 void *sd_context_loop (struct CitContext *con);
52 void start_daemon (int do_close_stdio);
53 void cmd_nset (char *cmdbuf);
54 int convert_login (char *NameToConvert);
55 void *worker_thread (void *arg);
56 void become_session(struct CitContext *which_con);
57 void CtdlRedirectOutput(FILE *fp, int sock);
58 void InitializeMasterCC(void);
59 void init_master_fdset(void);
60 void create_worker(void);
61
62 extern int num_sessions;
63 extern volatile int time_to_die;
64 extern int verbosity;
65 extern int rescan[];
66 extern pthread_t initial_thread;
67
68 extern struct worker_node {
69         pthread_t tid;
70         struct worker_node *next;
71 } *worker_list;
72
73 extern int SyslogFacility(char *name);
74 extern int syslog_facility;