5 * Uncomment this #define if you are a Citadel developer tracking
6 * down memory leaks in the server. Do NOT do this on a production
7 * system because it definitely incurs a lot of additional overhead.
9 /* #define DEBUG_MEMORY_LEAKS */
16 /* Logging levels - correspond to syslog(3) */
18 /* When about to exit the server for an unrecoverable error */
19 CTDL_EMERG, /* system is unusable */
20 /* Manual intervention is required to avoid an abnormal exit */
21 CTDL_ALERT, /* action must be taken immediately */
22 /* The server can continue to run with degraded functionality */
23 CTDL_CRIT, /* critical conditions */
24 /* An error occurs but the server continues to run normally */
25 CTDL_ERR, /* error conditions */
26 /* An abnormal condition was detected; server will continue normally */
27 CTDL_WARNING, /* warning conditions */
28 /* Normal messages (login/out, activity, etc.) */
29 CTDL_NOTICE, /* normal but significant condition */
30 /* Unimportant progress messages, etc. */
31 CTDL_INFO, /* informational */
32 /* Debugging messages */
33 CTDL_DEBUG /* debug-level messages */
37 void lprintf (enum LogLevel loglevel, const char *format, ...) __attribute__((__format__(__printf__,2,3)));
38 void cprintf (const char *format, ...) __attribute__((__format__(__printf__,1,2)));
40 void lprintf (enum LogLevel loglevel, const char *format, ...);
41 void cprintf (const char *format, ...);
44 extern pthread_key_t MyConKey; /* TSD key for MyContext() */
46 extern int enable_syslog;
48 void init_sysdep (void);
49 void begin_critical_section (int which_one);
50 void end_critical_section (int which_one);
51 int ig_tcp_server (char *ip_addr, int port_number, int queue_len);
52 int ig_uds_server(char *sockpath, int queue_len);
53 struct CitContext *MyContext (void);
54 struct CitContext *CreateNewContext (void);
55 void InitMyContext (struct CitContext *con);
56 void buffer_output(void);
57 void unbuffer_output(void);
58 void flush_output(void);
59 void client_write (char *buf, int nbytes);
60 int client_read_to (char *buf, int bytes, int timeout);
61 int client_read (char *buf, int bytes);
62 int client_getln (char *buf, int maxbytes);
63 void sysdep_master_cleanup (void);
64 void kill_session (int session_to_kill);
65 void *sd_context_loop (struct CitContext *con);
66 void start_daemon (int do_close_stdio);
67 void cmd_nset (char *cmdbuf);
68 int convert_login (char *NameToConvert);
69 void *worker_thread (void *arg);
70 void become_session(struct CitContext *which_con);
71 void InitializeMasterCC(void);
72 void init_master_fdset(void);
73 void create_worker(void);
75 extern int num_sessions;
76 extern volatile int time_to_die;
80 extern struct worker_node {
82 struct worker_node *next;
85 extern int SyslogFacility(char *name);
86 extern int syslog_facility;
88 #ifdef DEBUG_MEMORY_LEAKS
89 #define malloc(x) tracked_malloc(x, __FILE__, __LINE__)
90 #define realloc(x,y) tracked_realloc(x, y, __FILE__, __LINE__)
92 #define strdup(x) tracked_strdup(x, __FILE__, __LINE__)
93 #define free(x) tracked_free(x)
94 void *tracked_malloc(size_t size, char *file, int line);
95 void *tracked_realloc(void *ptr, size_t size, char *file, int line);
96 void tracked_free(void *ptr);
97 char *tracked_strdup(const char *s, char *file, int line);
101 void create_indexer_thread(void);
102 extern pthread_t indexer_thread_tid;