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 int enable_syslog;
46 void init_sysdep (void);
47 void begin_critical_section (int which_one);
48 void end_critical_section (int which_one);
49 int ig_tcp_server (char *ip_addr, int port_number, int queue_len);
50 int ig_uds_server(char *sockpath, int queue_len);
51 struct CitContext *MyContext (void);
52 struct CitContext *CreateNewContext (void);
53 void InitMyContext (struct CitContext *con);
54 void buffer_output(void);
55 void unbuffer_output(void);
56 void flush_output(void);
57 void client_write (char *buf, int nbytes);
58 int client_read_to (char *buf, int bytes, int timeout);
59 int client_read (char *buf, int bytes);
60 int client_getln (char *buf, int maxbytes);
61 void sysdep_master_cleanup (void);
62 void kill_session (int session_to_kill);
63 void *sd_context_loop (struct CitContext *con);
64 void start_daemon (int do_close_stdio);
65 void cmd_nset (char *cmdbuf);
66 int convert_login (char *NameToConvert);
67 void *worker_thread (void *arg);
68 void become_session(struct CitContext *which_con);
69 void InitializeMasterCC(void);
70 void init_master_fdset(void);
71 void create_worker(void);
73 extern int num_sessions;
74 extern volatile int time_to_die;
78 extern struct worker_node {
80 struct worker_node *next;
83 extern int SyslogFacility(char *name);
84 extern int syslog_facility;
86 #ifdef DEBUG_MEMORY_LEAKS
87 #define malloc(x) tracked_malloc(x, __FILE__, __LINE__)
88 #define realloc(x,y) tracked_realloc(x, y, __FILE__, __LINE__)
90 #define strdup(x) tracked_strdup(x, __FILE__, __LINE__)
91 #define free(x) tracked_free(x)
92 void *tracked_malloc(size_t size, char *file, int line);
93 void *tracked_realloc(void *ptr, size_t size, char *file, int line);
94 void tracked_free(void *ptr);
95 char *tracked_strdup(const char *s, char *file, int line);