/* $Id$ */
-/* 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 */
-
#ifndef SERVER_H
#define SERVER_H
char lastcmdname[5]; /* name of last command executed */
unsigned cs_flags; /* miscellaneous flags */
void (*h_command_function) (void) ; /* service command function */
+ void (*h_async_function) (void) ; /* do async msgs function */
int is_async; /* Nonzero if client accepts async msgs */
+ int async_waiting; /* Nonzero if there are async msgs waiting */
+ int input_waiting; /* Nonzero if there is client input waiting */
/* feeping creaturisms... */
int cs_clientdev; /* client developer ID */
char *output_buffer; /* hold output for one big dump */
int buffer_len;
- /* A linked list of all express messages sent to us. */
+ /* A linked list of all instant messages sent to us. */
struct ExpressMessage *FirstExpressMessage;
int disable_exp; /* Set to 1 to disable incoming pages */
int newmail; /* Other sessions increment this */
typedef struct CitContext t_context;
-/* Values for CitContext.state */
+/*
+ * Values for CitContext.state
+ *
+ * A session that is doing nothing is in CON_IDLE state. When activity
+ * is detected on the socket, it goes to CON_READY, indicating that it
+ * needs to have a worker thread bound to it. When a thread binds to
+ * the session, it goes to CON_EXECUTING and does its thing. When the
+ * transaction is finished, the thread sets it back to CON_IDLE and lets
+ * it go.
+ */
enum {
CON_IDLE, /* This context is doing nothing */
- CON_READY, /* This context is ready-to-run */
+ CON_READY, /* This context needs attention */
CON_EXECUTING, /* This context is bound to a thread */
};
S_PUBLIC_CLIENTS,
S_LDAP,
S_FLOORCACHE,
+ S_DEBUGMEMLEAKS,
MAX_SEMAPHORES
};
#define EVT_SETPASS 5 /* Setting or changing password */
#define EVT_CMD 6 /* Called after each server command */
#define EVT_RWHO 7 /* An RWHO command is being executed */
+#define EVT_ASYNC 8 /* Doing asynchronous messages */
#define EVT_TIMER 50 /* Timer events are called once per minute
and are not tied to any session */
/*
* ExpressMessageFunctionHook extensions are used for hooks which implement
- * the sending of an express message through various channels. Any function
+ * the sending of an instant message through various channels. Any function
* registered should return the number of recipients to whom the message was
* successfully transmitted.
*/
char *sockpath;
void (*h_greeting_function) (void) ;
void (*h_command_function) (void) ;
+ void (*h_async_function) (void) ;
int msock;
};
extern struct ServiceFunctionHook *ServiceHookTable;
};
-
-/* 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)
-#define strdoop(orig) tracked_strdup(orig, __FILE__, __LINE__)
-
-void *tracked_malloc(size_t, char *, int);
-void tracked_free(void *);
-void *tracked_realloc(void *, size_t);
-void dump_tracked(void);
-char *tracked_strdup(const char *, char *, int);
-
-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)
-#define strdoop(orig) strdup(orig)
-
-
-#endif
-
-
/*
* Serialization routines use this struct to return a pointer and a length
*/