/* $Id$ */
typedef pthread_t THREAD;
+/* Uncomment this if you want to track memory leaks.
+ * This incurs some overhead, so don't use it unless you're debugging the code!
+ */
+/* #define DEBUG_MEMORY_LEAKS */
-struct ExpressMessage {
- struct ExpressMessage *next;
- char em_text[300];
- };
/*
* Here's the big one... the Citadel context structure.
char net_node[32];
THREAD mythread;
int client_socket;
- struct ExpressMessage *FirstExpressMessage;
+ char *ExpressMessages;
int cs_pid; /* session ID */
- char cs_room[20]; /* current room */
+ char cs_room[ROOMNAMELEN]; /* current room */
time_t cs_lastupdt; /* time of last update */
time_t lastcmd; /* time of last command executed */
time_t lastidle; /* For computing idle time */
char dl_is_net;
char upload_type;
- char ucache_name[32]; /* For a performance boost, we cache */
- long ucache_pos; /* the position of the last user rec */
char fake_username[32]; /* Fake username <bc> */
char fake_postname[32]; /* Fake postname <bc> */
char fake_hostname[25]; /* Name of the fake hostname <bc> */
- char fake_roomname[20]; /* Name of the fake room <bc> */
+ char fake_roomname[ROOMNAMELEN];/* Name of the fake room <bc> */
char last_pager[32]; /* The username of the last pager */
int FloorBeingSearched; /* This is used by cmd_lrms() etc. */
-
- int CtdlErrno; /* Error return for CitadelAPI calls */
+ char desired_section[64]; /* This is used for MIME downloads */
};
typedef struct CitContext t_context;
#define UPL_IMAGE 2
+/*
+ * message transfer formats
+ */
+#define MT_CITADEL 0 /* Citadel proprietary */
+#define MT_DATE 1 /* We're only looking for the date */
+#define MT_RFC822 2 /* RFC822 */
+#define MT_RAW 3 /* IGnet raw format */
+#define MT_MIME 4 /* MIME-formatted message */
+#define MT_DOWNLOAD 5 /* Download a component */
+
/*
* Citadel DataBases (define one for each cdb we need to open)
/* Structures and declarations for function hooks of various types */
+struct LogFunctionHook {
+ struct LogFunctionHook *next;
+ int loglevel;
+ void (*h_function_pointer) (char *);
+ };
+extern struct LogFunctionHook *LogHookTable;
+
struct CleanupFunctionHook {
struct CleanupFunctionHook *next;
void (*h_function_pointer) (void);
/* Defines the relationship of a user to a particular room */
struct visit {
- char v_roomname[ROOMNAMELEN];
- long v_generation;
+ long v_roomnum;
+ long v_roomgen;
+ long v_usernum;
long v_lastseen;
unsigned int v_flags;
};
#define UA_GOTOALLOWED 4
#define UA_HASNEWMSGS 8
#define UA_ZAPPED 16
+
+
+
+/* Built-in debuggable stuff for checking for memory leaks */
+#ifdef DEBUG_MEMORY_LEAKS
+
+#define mallok(howbig) tracked_malloc(howbig, __FILE__, __LINE__)
+#define phree(whichptr) tracked_free(whichptr)
+#define reallok(whichptr,howbig) tracked_realloc(whichptr,howbig)
+
+void *tracked_malloc(size_t, char *, int);
+void tracked_free(void *);
+void *tracked_realloc(void *, size_t);
+void dump_tracked(void);
+
+struct TheHeap {
+ struct TheHeap *next;
+ char h_file[32];
+ int h_line;
+ void *h_ptr;
+ };
+
+extern struct TheHeap *heap;
+
+#else
+
+#define mallok(howbig) malloc(howbig)
+#define phree(whichptr) free(whichptr)
+#define reallok(whichptr,howbig) realloc(whichptr,howbig)
+
+#endif